]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nfsd: fh_drop_write in nfsd_unlink
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 12 Apr 2019 20:26:30 +0000 (16:26 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 24 Apr 2019 13:46:35 +0000 (09:46 -0400)
fh_want_write() can now be called twice, but I'm also fixing up the
callers not to do that.

Other cases include setattr and create.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/vfs.c

index 7dc98e14655df9af314cfec2f3df1ba3fbb32d10..fc24ee47eab51ad4bc486ba9f9b04c357089f2d0 100644 (file)
@@ -1786,12 +1786,12 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
        rdentry = lookup_one_len(fname, dentry, flen);
        host_err = PTR_ERR(rdentry);
        if (IS_ERR(rdentry))
-               goto out_nfserr;
+               goto out_drop_write;
 
        if (d_really_is_negative(rdentry)) {
                dput(rdentry);
-               err = nfserr_noent;
-               goto out;
+               host_err = -ENOENT;
+               goto out_drop_write;
        }
 
        if (!type)
@@ -1805,6 +1805,8 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
                host_err = commit_metadata(fhp);
        dput(rdentry);
 
+out_drop_write:
+       fh_drop_write(fhp);
 out_nfserr:
        err = nfserrno(host_err);
 out: