diff options
author | Rick Macklem <rmacklem@FreeBSD.org> | 2021-09-27 01:37:25 +0000 |
---|---|---|
committer | Rick Macklem <rmacklem@FreeBSD.org> | 2021-09-27 01:37:25 +0000 |
commit | 62c5be4ab4c8b8127185286e148638cb8cdf45f4 (patch) | |
tree | 08eed987f6b09e81c198cd9ccf16344f252ef512 | |
parent | 15d077995bd2c56b7b1742ea2d4e9070ff7e9427 (diff) | |
download | src-62c5be4ab4c8b8127185286e148638cb8cdf45f4.tar.gz src-62c5be4ab4c8b8127185286e148638cb8cdf45f4.zip |
nfscl: Add a check for "has acquired a delegation" to nfscl_removedeleg()
Commit 5e5ca4c8fc53 added a flag to a NFSv4 mount point that is set when
the first delegation is acquired from the NFSv4 server.
For a common case where delegations are not being issued by the
NFSv4 server, the nfscl_removedeleg() code acquires the mutex lock for
open/lock state, finds the delegation list empty, then just unlocks the
mutex and returns. This patch adds a check of the flag to avoid the
need to acquire the mutex for this common case.
This change appears to be performance neutral for a small number
of opens, but should reduce lock contention for a large number of opens
for the common case where server is not issuing delegations.
This commit should not affect the high level semantics of delegation
handling.
MFC after: 2 weeks
-rw-r--r-- | sys/fs/nfsclient/nfs_clstate.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 8ec5b80489f9..ddbfa40300d8 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -4604,6 +4604,12 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T *p, nfsv4stateid_t *stp) int igotlock = 0, triedrecall = 0, needsrecall, retcnt = 0, islept; nmp = VFSTONFS(vp->v_mount); + NFSLOCKMNT(nmp); + if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) { + NFSUNLOCKMNT(nmp); + return (retcnt); + } + NFSUNLOCKMNT(nmp); np = VTONFS(vp); NFSLOCKCLSTATE(); /* |