Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Aug 2010 23:50:09 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r211953 - head/sys/fs/nfsserver
Message-ID:  <201008282350.o7SNo9H9046806@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Sat Aug 28 23:50:09 2010
New Revision: 211953
URL: http://svn.freebsd.org/changeset/base/211953

Log:
  Add acquisition of a reference count on nfsv4root_lock to the
  nfsd_recalldelegation() function, since this function is called
  by nfsd threads when they are handling NFSv2 or NFSv3 RPCs, where
  no reference count would have been acquired.
  
  MFC after:	2 weeks

Modified:
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdstate.c	Sat Aug 28 22:14:24 2010	(r211952)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c	Sat Aug 28 23:50:09 2010	(r211953)
@@ -4563,6 +4563,14 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO
 		return;
 
 	/*
+	 * First, get a reference on the nfsv4rootfs_lock so that an
+	 * exclusive lock cannot be acquired by another thread.
+	 */
+	NFSLOCKV4ROOTMUTEX();
+	nfsv4_getref(&nfsv4rootfs_lock, NULL, NFSV4ROOTLOCKMUTEXPTR);
+	NFSUNLOCKV4ROOTMUTEX();
+
+	/*
 	 * Now, call nfsrv_checkremove() in a loop while it returns
 	 * NFSERR_DELAY. Return upon any other error or when timed out.
 	 */
@@ -4576,11 +4584,14 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO
 			    NFS_REMOVETIMEO &&
 			    ((u_int32_t)mytime.tv_sec - starttime) <
 			    100000)
-				return;
+				break;
 			/* Sleep for a short period of time */
 			(void) nfs_catnap(PZERO, 0, "nfsremove");
 		}
 	} while (error == NFSERR_DELAY);
+	NFSLOCKV4ROOTMUTEX();
+	nfsv4_relref(&nfsv4rootfs_lock);
+	NFSUNLOCKV4ROOTMUTEX();
 }
 
 APPLESTATIC void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008282350.o7SNo9H9046806>