Skip to content

Commit 0d0ea30

Browse files
author
Trond Myklebust
committed
NFS: Don't corrupt the value of pg_bytes_written in nfs_do_recoalesce()
The value of mirror->pg_bytes_written should only be updated after a successful attempt to flush out the requests on the list. Fixes: a7d42dd ("nfs: add mirroring support to pgio layer") Signed-off-by: Trond Myklebust <[email protected]>
1 parent 56517ab commit 0d0ea30

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

fs/nfs/pagelist.c

+5-7
Original file line numberDiff line numberDiff line change
@@ -1128,17 +1128,16 @@ static void nfs_pageio_doio(struct nfs_pageio_descriptor *desc)
11281128
{
11291129
struct nfs_pgio_mirror *mirror = nfs_pgio_current_mirror(desc);
11301130

1131-
11321131
if (!list_empty(&mirror->pg_list)) {
11331132
int error = desc->pg_ops->pg_doio(desc);
11341133
if (error < 0)
11351134
desc->pg_error = error;
1136-
else
1135+
if (list_empty(&mirror->pg_list)) {
11371136
mirror->pg_bytes_written += mirror->pg_count;
1138-
}
1139-
if (list_empty(&mirror->pg_list)) {
1140-
mirror->pg_count = 0;
1141-
mirror->pg_base = 0;
1137+
mirror->pg_count = 0;
1138+
mirror->pg_base = 0;
1139+
mirror->pg_recoalesce = 0;
1140+
}
11421141
}
11431142
}
11441143

@@ -1228,7 +1227,6 @@ static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc)
12281227

12291228
do {
12301229
list_splice_init(&mirror->pg_list, &head);
1231-
mirror->pg_bytes_written -= mirror->pg_count;
12321230
mirror->pg_count = 0;
12331231
mirror->pg_base = 0;
12341232
mirror->pg_recoalesce = 0;

0 commit comments

Comments
 (0)