1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

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.

MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2015-05-29 20:22:53 +00:00
parent 0aa6527ff0
commit 0c419e226c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283753

View File

@ -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;