diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2011-01-01 18:50:49 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2011-01-01 18:50:49 +0000 |
commit | 3c649dc5fa08d526b351e1c96a708fac4dce42a0 (patch) | |
tree | 29427507e98bfc660f90fd62a30f861359ec07cf | |
parent | 7fb616e10a032735e108811a5ef8d9dac10dcb8b (diff) | |
download | FreeBSD-src-3c649dc5fa08d526b351e1c96a708fac4dce42a0.zip FreeBSD-src-3c649dc5fa08d526b351e1c96a708fac4dce42a0.tar.gz |
Add support for shared vnode locks for the Read operation
in the experimental NFSv4 server.
Reviewed by: kib
MFC after: 2 weeks
-rw-r--r-- | sys/fs/nfs/nfs_commonsubs.c | 2 | ||||
-rw-r--r-- | sys/fs/nfsserver/nfs_nfsdstate.c | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 5f554d5..2f22490 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -109,7 +109,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV4OP_NOPS] = { { 1, 0, 0, 0, LK_EXCLUSIVE }, /* PutFH */ { 1, 0, 0, 0, LK_EXCLUSIVE }, /* PutPubFH */ { 1, 0, 0, 0, LK_EXCLUSIVE }, /* PutRootFH */ - { 0, 1, 0, 0, LK_EXCLUSIVE }, /* Read */ + { 0, 1, 0, 0, LK_SHARED }, /* Read */ { 0, 1, 0, 0, LK_SHARED }, /* Readdir */ { 0, 1, 0, 0, LK_SHARED }, /* ReadLink */ { 0, 2, 1, 1, LK_EXCLUSIVE }, /* Remove */ diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 9775644..829e7f6 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -4217,7 +4217,7 @@ static int nfsrv_clientconflict(struct nfsclient *clp, int *haslockp, __unused vnode_t vp, NFSPROC_T *p) { - int gotlock; + int gotlock, lktype; /* * If lease hasn't expired, we can't fix it. @@ -4227,7 +4227,8 @@ nfsrv_clientconflict(struct nfsclient *clp, int *haslockp, __unused vnode_t vp, return (0); if (*haslockp == 0) { NFSUNLOCKSTATE(); - NFSVOPUNLOCK(vp, 0, p); + lktype = VOP_ISLOCKED(vp); + VOP_UNLOCK(vp, 0); NFSLOCKV4ROOTMUTEX(); nfsv4_relref(&nfsv4rootfs_lock); do { @@ -4236,7 +4237,7 @@ nfsrv_clientconflict(struct nfsclient *clp, int *haslockp, __unused vnode_t vp, } while (!gotlock); NFSUNLOCKV4ROOTMUTEX(); *haslockp = 1; - NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, lktype | LK_RETRY); return (1); } NFSUNLOCKSTATE(); @@ -4278,7 +4279,7 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p, vnode_t vp) { struct nfsclient *clp = stp->ls_clp; - int gotlock, error, retrycnt, zapped_clp; + int gotlock, error, lktype, retrycnt, zapped_clp; nfsv4stateid_t tstateid; fhandle_t tfh; @@ -4391,7 +4392,8 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p, */ if (*haslockp == 0) { NFSUNLOCKSTATE(); - NFSVOPUNLOCK(vp, 0, p); + lktype = VOP_ISLOCKED(vp); + VOP_UNLOCK(vp, 0); NFSLOCKV4ROOTMUTEX(); nfsv4_relref(&nfsv4rootfs_lock); do { @@ -4400,7 +4402,7 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p, } while (!gotlock); NFSUNLOCKV4ROOTMUTEX(); *haslockp = 1; - NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, lktype | LK_RETRY); return (-1); } |