summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2015-06-12 22:05:04 +0000
committerrmacklem <rmacklem@FreeBSD.org>2015-06-12 22:05:04 +0000
commitf46a7a1d85af3abffe292133ec0574f9f814c170 (patch)
treeccebaf473513980c26c7aa17cee993e9fef70e2b /sys/fs
parent11074f6b1e6b24bcac4e18463aedabbe359b370b (diff)
downloadFreeBSD-src-f46a7a1d85af3abffe292133ec0574f9f814c170.zip
FreeBSD-src-f46a7a1d85af3abffe292133ec0574f9f814c170.tar.gz
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.
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfsserver/nfs_nfsdsocket.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c
index 9c00a0c..4497161 100644
--- a/sys/fs/nfsserver/nfs_nfsdsocket.c
+++ b/sys/fs/nfsserver/nfs_nfsdsocket.c
@@ -440,9 +440,12 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen,
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 *nd, int isdgram, u_char *tag,
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;
OpenPOWER on IntegriCloud