NFSD: Clean up nfsd_vfs_write()
authorChuck Lever <chuck.lever@oracle.com>
Tue, 28 Dec 2021 19:19:41 +0000 (14:19 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Sat, 8 Jan 2022 19:42:02 +0000 (14:42 -0500)
The RWF_SYNC and !RWF_SYNC arms are now exactly alike except that
the RWF_SYNC arm resets the boot verifier twice in a row. Fix that
redundancy and de-duplicate the code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/vfs.c

index 316ed70..8f0ac71 100644 (file)
@@ -997,22 +997,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct nfsd_file *nf,
 
        iov_iter_kvec(&iter, WRITE, vec, vlen, *cnt);
        since = READ_ONCE(file->f_wb_err);
-       if (flags & RWF_SYNC) {
-               if (verf)
-                       nfsd_copy_boot_verifier(verf,
-                                       net_generic(SVC_NET(rqstp),
-                                       nfsd_net_id));
-               host_err = vfs_iter_write(file, &iter, &pos, flags);
-               if (host_err < 0)
-                       nfsd_reset_boot_verifier(net_generic(SVC_NET(rqstp),
-                                                nfsd_net_id));
-       } else {
-               if (verf)
-                       nfsd_copy_boot_verifier(verf,
-                                       net_generic(SVC_NET(rqstp),
-                                       nfsd_net_id));
-               host_err = vfs_iter_write(file, &iter, &pos, flags);
-       }
+       if (verf)
+               nfsd_copy_boot_verifier(verf,
+                               net_generic(SVC_NET(rqstp),
+                               nfsd_net_id));
+       host_err = vfs_iter_write(file, &iter, &pos, flags);
        if (host_err < 0) {
                nfsd_reset_boot_verifier(net_generic(SVC_NET(rqstp),
                                         nfsd_net_id));