Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jun 2015 22:05:05 +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-10@freebsd.org
Subject:   svn commit: r284334 - stable/10/sys/fs/nfsserver
Message-ID:  <201506122205.t5CM55Hq060088@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Fri Jun 12 22:05:04 2015
New Revision: 284334
URL: https://svnweb.freebsd.org/changeset/base/284334

Log:
  MFC: r283753
  Make the NFS server use shared vnode locks for a few cases
  that are allowed by the VFS/VOP interface instead of using
  exclusive locks.

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c
==============================================================================
--- stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c	Fri Jun 12 19:42:27 2015	(r284333)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c	Fri Jun 12 22:05:04 2015	(r284334)
@@ -440,9 +440,12 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, 
 			if (nd->nd_procnum == NFSPROC_READ ||
 			    nd->nd_procnum == NFSPROC_WRITE ||
 			    nd->nd_procnum == NFSPROC_READDIR ||
+			    nd->nd_procnum == NFSPROC_READDIRPLUS ||
 			    nd->nd_procnum == NFSPROC_READLINK ||
 			    nd->nd_procnum == NFSPROC_GETATTR ||
-			    nd->nd_procnum == NFSPROC_ACCESS)
+			    nd->nd_procnum == NFSPROC_ACCESS ||
+			    nd->nd_procnum == NFSPROC_FSSTAT ||
+			    nd->nd_procnum == NFSPROC_FSINFO)
 				lktype = LK_SHARED;
 			else
 				lktype = LK_EXCLUSIVE;
@@ -544,7 +547,7 @@ static void
 nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
     int taglen, u_int32_t minorvers, NFSPROC_T *p)
 {
-	int i, op, op0 = 0;
+	int i, lktype, op, op0 = 0;
 	u_int32_t *tl;
 	struct nfsclient *clp, *nclp;
 	int numops, error = 0, igotlock;
@@ -953,11 +956,15 @@ nfsrvd_compound(struct nfsrv_descript *n
 				panic("nfsrvd_compound");
 			if (nfsv4_opflag[op].needscfh) {
 				if (vp != NULL) {
-					if (nfsv4_opflag[op].modifyfs)
+					lktype = nfsv4_opflag[op].lktype;
+					if (nfsv4_opflag[op].modifyfs) {
 						vn_start_write(vp, &temp_mp,
 						    V_WAIT);
-					if (NFSVOPLOCK(vp, nfsv4_opflag[op].lktype)
-					    == 0)
+						if (op == NFSV4OP_WRITE &&
+						    MNT_SHARED_WRITES(temp_mp))
+							lktype = LK_SHARED;
+					}
+					if (NFSVOPLOCK(vp, lktype) == 0)
 						VREF(vp);
 					else
 						nd->nd_repstat = NFSERR_PERM;



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