Re: Linux 4.10-rc7

From: Christoph Hellwig
Date: Mon Feb 06 2017 - 03:19:42 EST


On Mon, Feb 06, 2017 at 01:00:32AM -0500, Dave Jones wrote:
> This one smells funny to me.

Double mnt_want_write, no idea why lockdep isn't reporting that for me.
Fix below:

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index ca13236dbb1f..a974368026a1 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -359,11 +359,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
err = fh_verify(rqstp, fhp, ftype, accmode);
if (err)
return err;
- if (get_write_count) {
- host_err = fh_want_write(fhp);
- if (host_err)
- goto out_host_err;
- }

dentry = fhp->fh_dentry;
inode = d_inode(dentry);
@@ -416,6 +411,12 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,

iap->ia_valid |= ATTR_CTIME;

+ if (get_write_count) {
+ host_err = fh_want_write(fhp);
+ if (host_err)
+ goto out_host_err;
+ }
+
fh_lock(fhp);
host_err = notify_change(dentry, iap, NULL);
fh_unlock(fhp);