svn commit: r216841 - stable/8/sys/fs/nfsserver

Rick Macklem rmacklem at FreeBSD.org
Fri Dec 31 14:03:58 UTC 2010


Author: rmacklem
Date: Fri Dec 31 14:03:57 2010
New Revision: 216841
URL: http://svn.freebsd.org/changeset/base/216841

Log:
  MFC: r216510
  Fix two vnode locking problems in nfsd_recalldelegation() in the
  experimental NFSv4 server. The first was a bogus use of VOP_ISLOCKED()
  in a KASSERT() and the second was the need to lock the vnode for the
  nfsrv_checkremove() call. Also, delete a "__unused" that was bogus,
  since the argument is used.

Modified:
  stable/8/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c	Fri Dec 31 13:07:21 2010	(r216840)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c	Fri Dec 31 14:03:57 2010	(r216841)
@@ -4275,7 +4275,7 @@ nfsrv_clientconflict(struct nfsclient *c
  */
 static int
 nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p,
-    __unused vnode_t vp)
+    vnode_t vp)
 {
 	struct nfsclient *clp = stp->ls_clp;
 	int gotlock, error, retrycnt, zapped_clp;
@@ -4568,8 +4568,6 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO
 	int32_t starttime;
 	int error;
 
-	KASSERT(!VOP_ISLOCKED(vp), ("vp %p is locked", vp));
-
 	/*
 	 * First, check to see if the server is currently running and it has
 	 * been called for a regular file when issuing delegations.
@@ -4578,6 +4576,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO
 	    nfsrv_issuedelegs == 0)
 		return;
 
+	KASSERT((VOP_ISLOCKED(vp) != LK_EXCLUSIVE), ("vp %p is locked", vp));
 	/*
 	 * First, get a reference on the nfsv4rootfs_lock so that an
 	 * exclusive lock cannot be acquired by another thread.
@@ -4593,7 +4592,12 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO
 	NFSGETNANOTIME(&mytime);
 	starttime = (u_int32_t)mytime.tv_sec;
 	do {
-		error = nfsrv_checkremove(vp, 0, p);
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+		if ((vp->v_iflag & VI_DOOMED) == 0)
+			error = nfsrv_checkremove(vp, 0, p);
+		else
+			error = EPERM;
+		VOP_UNLOCK(vp, 0);
 		if (error == NFSERR_DELAY) {
 			NFSGETNANOTIME(&mytime);
 			if (((u_int32_t)mytime.tv_sec - starttime) >


More information about the svn-src-all mailing list