diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2016-04-12 20:23:09 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2016-04-12 20:23:09 +0000 |
commit | c78bfcfb8f824930b3780c411e7a2031bd719c33 (patch) | |
tree | cf7c12cd4fbf9b2fb823d795afeba814c396a430 /sys/fs/nfsserver | |
parent | 2a0941fb20351d00765ce970ea44efcc0f389e3b (diff) | |
download | FreeBSD-src-c78bfcfb8f824930b3780c411e7a2031bd719c33.zip FreeBSD-src-c78bfcfb8f824930b3780c411e7a2031bd719c33.tar.gz |
If the VOP_SETATTR() call that saves the exclusive create verifier failed,
the NFS server would leave the newly created vnode locked. This could
result in a file system that would not unmount and processes wedged,
waiting for the file to be unlocked.
Since this VOP_SETATTR() never fails for most file systems, this bug
doesn't normally manifest itself. I found it during testing of an
exported GlusterFS file system, which can fail.
This patch adds the vput() and changes the error to the correct NFS one.
MFC after: 2 weeks
Diffstat (limited to 'sys/fs/nfsserver')
-rw-r--r-- | sys/fs/nfsserver/nfs_nfsdport.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 44ae88e..a1e1204 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -794,6 +794,11 @@ nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp, nvap->na_atime.tv_nsec = cverf[1]; error = VOP_SETATTR(ndp->ni_vp, &nvap->na_vattr, nd->nd_cred); + if (error != 0) { + vput(ndp->ni_vp); + ndp->ni_vp = NULL; + error = NFSERR_NOTSUPP; + } } } /* @@ -1422,6 +1427,11 @@ nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp, nvap->na_atime.tv_nsec = cverf[1]; nd->nd_repstat = VOP_SETATTR(ndp->ni_vp, &nvap->na_vattr, cred); + if (nd->nd_repstat != 0) { + vput(ndp->ni_vp); + ndp->ni_vp = NULL; + nd->nd_repstat = NFSERR_NOTSUPP; + } } else { nfsrv_fixattr(nd, ndp->ni_vp, nvap, aclp, p, attrbitp, exp); |