]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
nfs: always check dreq->error after a commit
authorJeff Layton <jlayton@kernel.org>
Fri, 22 Jul 2022 18:12:19 +0000 (14:12 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 23 Jul 2022 19:28:59 +0000 (15:28 -0400)
When the client gets back a short DIO write, it will then attempt to
issue another write to finish the DIO request. If that write then fails
(as is often the case in an -ENOSPC situation), then we still may need
to issue a COMMIT if the earlier short write was unstable. If that COMMIT
then succeeds, then we don't want the client to reschedule the write
requests, and to instead just return a short write. Otherwise, we can
end up looping over the same DIO write forever.

Always consult dreq->error after a successful RPC, even when the flag
state is not NFS_ODIRECT_DONE.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2028370
Reported-by: Boyang Xue <bxue@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/direct.c

index ad40e81857ee442fe75b2ce2c6a03fefd2f7c59f..a47d132961948c9f5476d4b99507877d46aba556 100644 (file)
@@ -571,8 +571,9 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data)
                dreq->max_count = 0;
                dreq->count = 0;
                dreq->flags = NFS_ODIRECT_DONE;
-       } else if (dreq->flags == NFS_ODIRECT_DONE)
+       } else {
                status = dreq->error;
+       }
 
        nfs_init_cinfo_from_dreq(&cinfo, dreq);