aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/nfsserver
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2017-04-24 20:46:19 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2017-04-24 20:46:19 +0000
commit858f6fe3271409354e450a193e98f1720d8c1863 (patch)
tree456fb86e7260f33e3e99a2457379c255652603fc /sys/fs/nfsserver
parent7ef35d05aaaab92b476bebd14576ae89d969bf4f (diff)
downloadsrc-858f6fe3271409354e450a193e98f1720d8c1863.tar.gz
src-858f6fe3271409354e450a193e98f1720d8c1863.zip
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
Notes
Notes: svn path=/head/; revision=317382
Diffstat (limited to 'sys/fs/nfsserver')
-rw-r--r--sys/fs/nfsserver/nfs_nfsdstate.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index 1c2e7d1a762e..f494071171f3 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -75,6 +75,11 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, writedelegifpos, CTLFLAG_RW,
&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))) {