Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Apr 2017 20:46:19 +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: r317382 - head/sys/fs/nfsserver
Message-ID:  <201704242046.v3OKkJW7066680@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Mon Apr 24 20:46:19 2017
New Revision: 317382
URL: https://svnweb.freebsd.org/changeset/base/317382

Log:
  Allow use of a write open stateid for reading in the NFSv4 server.
  
  The NFSv4 RFCs give a server the option of allowing the use of an open
  stateid for write access to be used for a Read operation.
  This patch enables this by default and adds a sysctl to disable it,
  for anyone who does not want this capability.
  Allowing this is particularily useful for a pNFS Data Server (DS), since
  they are not permitted to allow the use of special stateids.
  Discovered during recent testing of the pNFS server under development.
  
  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	Mon Apr 24 20:34:56 2017	(r317381)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c	Mon Apr 24 20:46:19 2017	(r317382)
@@ -75,6 +75,11 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, writedel
     &nfsrv_writedelegifpos, 0,
     "Issue a write delegation for read opens if possible");
 
+static int	nfsrv_allowreadforwriteopen = 1;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, allowreadforwriteopen, CTLFLAG_RW,
+    &nfsrv_allowreadforwriteopen, 0,
+    "Allow Reads to be done with Write Access StateIDs");
+
 /*
  * Hash lists for nfs V4.
  */
@@ -1872,7 +1877,8 @@ tryagain:
 		       mystp->ls_flags & NFSLCK_ACCESSBITS)) ||
 		    ((new_stp->ls_flags & (NFSLCK_CHECK|NFSLCK_READACCESS)) ==
 		      (NFSLCK_CHECK | NFSLCK_READACCESS) &&
-		     !(mystp->ls_flags & NFSLCK_READACCESS)) ||
+		     !(mystp->ls_flags & NFSLCK_READACCESS) &&
+		     nfsrv_allowreadforwriteopen == 0) ||
 		    ((new_stp->ls_flags & (NFSLCK_CHECK|NFSLCK_WRITEACCESS)) ==
 		      (NFSLCK_CHECK | NFSLCK_WRITEACCESS) &&
 		     !(mystp->ls_flags & NFSLCK_WRITEACCESS))) {



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