NFSD: Avoid calling fh_drop_write() twice in do_nfsd_create()
authorChuck Lever <chuck.lever@oracle.com>
Mon, 28 Mar 2022 14:16:42 +0000 (10:16 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 20 May 2022 17:18:24 +0000 (13:18 -0400)
Clean up: The "out" label already invokes fh_drop_write().

Note that fh_drop_write() is already careful not to invoke
mnt_drop_write() if either it has already been done or there is
nothing to drop. Therefore no change in behavior is expected.

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

index 4c1984f07cdc58fb51cb6840178cf3a44c94a464..bbed7a986784a9fc0b2353976c58be655ca78b2c 100644 (file)
@@ -1479,7 +1479,6 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
                case NFS3_CREATE_GUARDED:
                        err = nfserr_exist;
                }
-               fh_drop_write(fhp);
                goto out;
        }
 
@@ -1487,10 +1486,8 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
                iap->ia_mode &= ~current_umask();
 
        host_err = vfs_create(&init_user_ns, dirp, dchild, iap->ia_mode, true);
-       if (host_err < 0) {
-               fh_drop_write(fhp);
+       if (host_err < 0)
                goto out_nfserr;
-       }
        if (created)
                *created = true;