Date: Sat, 7 May 2016 00:07:03 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r299209 - stable/9/sys/fs/nfsserver Message-ID: <201605070007.u47073mF064577@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Sat May 7 00:07:03 2016 New Revision: 299209 URL: https://svnweb.freebsd.org/changeset/base/299209 Log: MFC: r297869 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. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdport.c Sat May 7 00:02:28 2016 (r299208) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.c Sat May 7 00:07:03 2016 (r299209) @@ -788,6 +788,11 @@ nfsvno_createsub(struct nfsrv_descript * 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; + } } } /* @@ -1413,6 +1418,11 @@ nfsvno_open(struct nfsrv_descript *nd, s 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605070007.u47073mF064577>