diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2014-01-01 02:49:45 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2014-01-01 02:49:45 +0000 |
commit | e876d4736cec7a72c621f94d97df99a81f04693a (patch) | |
tree | 8468e7f782ca8c4cf5ada54dc0f7b9e73e3a2127 /sys/fs/nfsserver/nfs_nfsdport.c | |
parent | 0b3ac62883e350fd41c5565331525f6ba9ff38c0 (diff) | |
download | FreeBSD-src-e876d4736cec7a72c621f94d97df99a81f04693a.zip FreeBSD-src-e876d4736cec7a72c621f94d97df99a81f04693a.tar.gz |
MFC: r259854
The NFSv4 server would call VOP_SETATTR() with a shared locked vnode
when a Getattr for a file is done by a client other than the one that
holds the file's delegation. This would only happen when delegations
are enabled and the problem is fixed by this patch.
Diffstat (limited to 'sys/fs/nfsserver/nfs_nfsdport.c')
-rw-r--r-- | sys/fs/nfsserver/nfs_nfsdport.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 89fc66e..ef26f64 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -1469,8 +1469,9 @@ nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp, * Updates the file rev and sets the mtime and ctime * to the current clock time, returning the va_filerev and va_Xtime * values. + * Return ESTALE to indicate the vnode is VI_DOOMED. */ -void +int nfsvno_updfilerev(struct vnode *vp, struct nfsvattr *nvap, struct ucred *cred, struct thread *p) { @@ -1478,8 +1479,14 @@ nfsvno_updfilerev(struct vnode *vp, struct nfsvattr *nvap, VATTR_NULL(&va); vfs_timestamp(&va.va_mtime); + if (NFSVOPISLOCKED(vp) != LK_EXCLUSIVE) { + NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY); + if ((vp->v_iflag & VI_DOOMED) != 0) + return (ESTALE); + } (void) VOP_SETATTR(vp, &va, cred); (void) nfsvno_getattr(vp, nvap, cred, p, 1); + return (0); } /* |