aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/nfsclient
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2021-10-30 03:35:02 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2021-10-30 03:35:02 +0000
commitdc6dd769de63c4eceb8899205a5d780d9f278fd2 (patch)
tree9a11f17d7c77a41bff1d13cc6ac464dc2858bd2d /sys/fs/nfsclient
parent141a53cd58cdf0681f800bb98ed5718f32ea7909 (diff)
downloadsrc-dc6dd769de63c4eceb8899205a5d780d9f278fd2.tar.gz
src-dc6dd769de63c4eceb8899205a5d780d9f278fd2.zip
nfscl: Use NFSMNTP_DELEGISSUED in two more functions
Commit 5e5ca4c8fc53 added a NFSMNTP_DELEGISSUED flag to indicate when a delegation has been issued to the mount. For the common case where an NFSv4 server is not issuing delegations, this flag can be checked to avoid acquisition of the NFSCLSTATEMUTEX. This patch adds checks for NFSMNTP_DELEGISSUED being set to two more functions. 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. MFC after: 2 week
Diffstat (limited to 'sys/fs/nfsclient')
-rw-r--r--sys/fs/nfsclient/nfs_clstate.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 36f8bbd6b51f..549d2f8ff538 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -4565,6 +4565,12 @@ nfscl_mustflush(vnode_t vp)
nmp = VFSTONFS(vp->v_mount);
if (!NFSHASNFSV4(nmp))
return (1);
+ NFSLOCKMNT(nmp);
+ if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) {
+ NFSUNLOCKMNT(nmp);
+ return (1);
+ }
+ NFSUNLOCKMNT(nmp);
NFSLOCKCLSTATE();
clp = nfscl_findcl(nmp);
if (clp == NULL) {
@@ -4748,6 +4754,12 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stateid_t *fstp, int *gotfdp, vnode_t tvp,
*gottdp = 0;
if (NFSHASPNFS(nmp))
return (retcnt);
+ NFSLOCKMNT(nmp);
+ if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) {
+ NFSUNLOCKMNT(nmp);
+ return (retcnt);
+ }
+ NFSUNLOCKMNT(nmp);
NFSLOCKCLSTATE();
/*
* Loop around waiting for: