svn commit: r217437 - in stable/8/sys/fs: nfs nfsserver

Rick Macklem rmacklem at FreeBSD.org
Sat Jan 15 01:03:27 UTC 2011


Author: rmacklem
Date: Sat Jan 15 01:03:26 2011
New Revision: 217437
URL: http://svn.freebsd.org/changeset/base/217437

Log:
  MFC: r216875
  Add support for shared vnode locks for the Read operation
  in the experimental NFSv4 server.

Modified:
  stable/8/sys/fs/nfs/nfs_commonsubs.c
  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/nfs/nfs_commonsubs.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonsubs.c	Sat Jan 15 00:34:50 2011	(r217436)
+++ stable/8/sys/fs/nfs/nfs_commonsubs.c	Sat Jan 15 01:03:26 2011	(r217437)
@@ -109,7 +109,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV4OP
 	{ 1, 0, 0, 0, LK_EXCLUSIVE },		/* PutFH */
 	{ 1, 0, 0, 0, LK_EXCLUSIVE },		/* PutPubFH */
 	{ 1, 0, 0, 0, LK_EXCLUSIVE },		/* PutRootFH */
-	{ 0, 1, 0, 0, LK_EXCLUSIVE },		/* Read */
+	{ 0, 1, 0, 0, LK_SHARED },		/* Read */
 	{ 0, 1, 0, 0, LK_SHARED },		/* Readdir */
 	{ 0, 1, 0, 0, LK_SHARED },		/* ReadLink */
 	{ 0, 2, 1, 1, LK_EXCLUSIVE },		/* Remove */

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c	Sat Jan 15 00:34:50 2011	(r217436)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c	Sat Jan 15 01:03:26 2011	(r217437)
@@ -4217,7 +4217,7 @@ static int
 nfsrv_clientconflict(struct nfsclient *clp, int *haslockp, __unused vnode_t vp,
     NFSPROC_T *p)
 {
-	int gotlock;
+	int gotlock, lktype;
 
 	/*
 	 * If lease hasn't expired, we can't fix it.
@@ -4227,7 +4227,8 @@ nfsrv_clientconflict(struct nfsclient *c
 		return (0);
 	if (*haslockp == 0) {
 		NFSUNLOCKSTATE();
-		NFSVOPUNLOCK(vp, 0, p);
+		lktype = VOP_ISLOCKED(vp);
+		VOP_UNLOCK(vp, 0);
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_relref(&nfsv4rootfs_lock);
 		do {
@@ -4236,7 +4237,7 @@ nfsrv_clientconflict(struct nfsclient *c
 		} while (!gotlock);
 		NFSUNLOCKV4ROOTMUTEX();
 		*haslockp = 1;
-		NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p);
+		vn_lock(vp, lktype | LK_RETRY);
 		return (1);
 	}
 	NFSUNLOCKSTATE();
@@ -4278,7 +4279,7 @@ nfsrv_delegconflict(struct nfsstate *stp
     vnode_t vp)
 {
 	struct nfsclient *clp = stp->ls_clp;
-	int gotlock, error, retrycnt, zapped_clp;
+	int gotlock, error, lktype, retrycnt, zapped_clp;
 	nfsv4stateid_t tstateid;
 	fhandle_t tfh;
 
@@ -4391,7 +4392,8 @@ nfsrv_delegconflict(struct nfsstate *stp
 	 */
 	if (*haslockp == 0) {
 		NFSUNLOCKSTATE();
-		NFSVOPUNLOCK(vp, 0, p);
+		lktype = VOP_ISLOCKED(vp);
+		VOP_UNLOCK(vp, 0);
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_relref(&nfsv4rootfs_lock);
 		do {
@@ -4400,7 +4402,7 @@ nfsrv_delegconflict(struct nfsstate *stp
 		} while (!gotlock);
 		NFSUNLOCKV4ROOTMUTEX();
 		*haslockp = 1;
-		NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p);
+		vn_lock(vp, lktype | LK_RETRY);
 		return (-1);
 	}
 


More information about the svn-src-all mailing list