Date: Mon, 17 Feb 2025 23:42:28 GMT From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 7e26f1c21049 - main - nfscl: Move layout high water variables into clientID Message-ID: <202502172342.51HNgSgd091806@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7e26f1c21049b5a1a2f490d8ac1909ccb24f0db2 commit 7e26f1c21049b5a1a2f490d8ac1909ccb24f0db2 Author: Rick Macklem <rmacklem@FreeBSD.org> AuthorDate: 2025-02-17 23:41:34 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> CommitDate: 2025-02-17 23:41:34 +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. MFC after: 2 weeks --- 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 86b51a7b3343..7e5baa453ad0 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 **); @@ -919,6 +918,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, @@ -2978,13 +2979,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) @@ -5286,7 +5288,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) @@ -5661,7 +5663,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?202502172342.51HNgSgd091806>