Date: Mon, 3 Mar 2025 01:56:28 GMT From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b27900b8d9db - stable/14 - nfscl: Move layout high water variables into clientID Message-ID: <202503030156.5231uSTM002618@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b27900b8d9db139725bdb4e8e239a0d9ef308e4b commit b27900b8d9db139725bdb4e8e239a0d9ef308e4b Author: Rick Macklem <rmacklem@FreeBSD.org> AuthorDate: 2025-02-17 23:41:34 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> CommitDate: 2025-03-03 01:55:37 +0000 nfscl: Move layout high water variables into clientID Commit f5aff1871d32 moved the delegation high water variables into the clientID structure, so that they are now per mount instead of global. This patch does the same for the layout highwater variables. It happens that the layout highwater variables are not actually used. This patch changes the code to use them. This is needed to add support for the CB_RECALL_ANY callback in a future commit. This patch only affects NFSv4.1/4.2 mounts with the "pnfs" mount option. The effect on these mounts will be minimal, since layouts are returned when they are stale and this normally ensures that the highwater mark is never hit. (cherry picked from commit 7e26f1c21049b5a1a2f490d8ac1909ccb24f0db2) --- sys/fs/nfs/nfsclstate.h | 2 ++ sys/fs/nfsclient/nfs_clstate.c | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfs/nfsclstate.h b/sys/fs/nfs/nfsclstate.h index 84088a2a4fd2..92669ff8d1aa 100644 --- a/sys/fs/nfs/nfsclstate.h +++ b/sys/fs/nfs/nfsclstate.h @@ -118,6 +118,8 @@ struct nfsclclient { time_t nfsc_expire; int nfsc_delegcnt; int nfsc_deleghighwater; + int nfsc_layoutcnt; + int nfsc_layouthighwater; u_int32_t nfsc_clientidrev; u_int32_t nfsc_rev; u_int32_t nfsc_renew; diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index ad30a306c31d..12894e3dcb84 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -94,7 +94,6 @@ NFSCLSTATEMUTEX; int nfscl_inited = 0; struct nfsclhead nfsclhead; /* Head of clientid list */ -static int nfscl_layoutcnt = 0; static int nfscl_getopen(struct nfsclownerhead *, struct nfsclopenhash *, u_int8_t *, int, u_int8_t *, u_int8_t *, u_int32_t, struct nfscllockowner **, struct nfsclopen **); @@ -923,6 +922,8 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, clp->nfsc_flags = NFSCLFLAGS_INITED; clp->nfsc_delegcnt = 0; clp->nfsc_deleghighwater = NFSCLDELEGHIGHWATER; + clp->nfsc_layoutcnt = 0; + clp->nfsc_layouthighwater = NFSCLLAYOUTHIGHWATER; clp->nfsc_clientidrev = 1; clp->nfsc_cbident = nfscl_nextcbident(); nfscl_fillclid(nmp->nm_clval, uuid, clp->nfsc_id, @@ -2982,13 +2983,14 @@ tryagain2: lyp = TAILQ_LAST(&clp->nfsc_layout, nfscllayouthead); while (lyp != NULL) { nlyp = TAILQ_PREV(lyp, nfscllayouthead, nfsly_list); - if (lyp->nfsly_timestamp < NFSD_MONOSEC && + if ((lyp->nfsly_timestamp < NFSD_MONOSEC || + clp->nfsc_layoutcnt > clp->nfsc_layouthighwater) && (lyp->nfsly_flags & (NFSLY_RECALL | NFSLY_RETONCLOSE)) == 0 && lyp->nfsly_lock.nfslock_usecnt == 0 && lyp->nfsly_lock.nfslock_lock == 0) { NFSCL_DEBUG(4, "ret stale lay=%d\n", - nfscl_layoutcnt); + clp->nfsc_layoutcnt); recallp = malloc(sizeof(*recallp), M_NFSLAYRECALL, M_NOWAIT); if (recallp == NULL) @@ -5293,7 +5295,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, LIST_INSERT_HEAD(NFSCLLAYOUTHASH(clp, fhp, fhlen), lyp, nfsly_hash); lyp->nfsly_timestamp = NFSD_MONOSEC + 120; - nfscl_layoutcnt++; + clp->nfsc_layoutcnt++; nfsstatsv1.cllayouts++; } else { if (retonclose != 0) @@ -5668,7 +5670,7 @@ nfscl_freelayout(struct nfscllayout *layp) LIST_REMOVE(rp, nfsrecly_list); free(rp, M_NFSLAYRECALL); } - nfscl_layoutcnt--; + layp->nfsly_clp->nfsc_layoutcnt--; nfsstatsv1.cllayouts--; free(layp, M_NFSLAYOUT); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202503030156.5231uSTM002618>