Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Feb 2025 21:23:09 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: 9fed5151903f - stable/14 - nfscl: Add support for CB_RECALL_SLOT
Message-ID:  <202502282123.51SLN9M9016666@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=9fed5151903fa609bf06f2b526a105fc21793651

commit 9fed5151903fa609bf06f2b526a105fc21793651
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2025-02-14 20:56:52 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2025-02-28 21:22:03 +0000

    nfscl: Add support for CB_RECALL_SLOT
    
    The callback CB_RECALL_SLOT is required for NFSv4.1/4.2.
    Fortunately, there does not appear to be any extant
    NFSv4.1/4.2 servers that use it.  Since commit b97a478896e9
    fixed handling of session slot shrinking, this patch
    adds support for CB_RECALL_SLOT, which shrinks the
    number of session slots as well.
    
    (cherry picked from commit 4517fbfd4251180147082f94253c4347fa44f570)
---
 sys/fs/nfs/nfs_commonkrpc.c    |  4 ++--
 sys/fs/nfs/nfs_var.h           |  1 +
 sys/fs/nfsclient/nfs_clstate.c | 18 ++++++++++++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c
index e35172ee2b34..0ae3b94bef89 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -123,7 +123,6 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, skip_wcc_data_onerr, CTLFLAG_RW, &nfs_skip_wcc_da
 SYSCTL_INT(_vfs_nfs, OID_AUTO, dsretries, CTLFLAG_RW, &nfs_dsretries, 0,
     "Number of retries for a DS RPC before failure");
 
-static void	nfs_resetslots(struct nfsclsession *);
 static void	nfs_down(struct nfsmount *, struct thread *, const char *,
     int, int);
 static void	nfs_up(struct nfsmount *, struct thread *, const char *,
@@ -1474,12 +1473,13 @@ nfsmout:
 /*
  * Reset slots above nfsess_foreslots that are not busy.
  */
-static void
+void
 nfs_resetslots(struct nfsclsession *sep)
 {
 	int i;
 	uint64_t bitval;
 
+	mtx_assert(&sep->nfsess_mtx, MA_OWNED);
 	bitval = (1 << sep->nfsess_foreslots);
 	for (i = sep->nfsess_foreslots; i < NFSV4_SLOTS; i++) {
 		if ((sep->nfsess_slots & bitval) == 0 &&
diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h
index c726d956fee2..8b8b3f5ce961 100644
--- a/sys/fs/nfs/nfs_var.h
+++ b/sys/fs/nfs/nfs_var.h
@@ -780,6 +780,7 @@ int newnfs_request(struct nfsrv_descript *, struct nfsmount *,
     struct nfsclient *, struct nfssockreq *, vnode_t, NFSPROC_T *,
     struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *,
     struct nfsclsession *);
+void nfs_resetslots(struct nfsclsession *);
 int newnfs_connect(struct nfsmount *, struct nfssockreq *,
     struct ucred *, NFSPROC_T *, int, bool, struct __rpc_client **);
 void newnfs_disconnect(struct nfsmount *, struct nfssockreq *);
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index a666792c17f9..e803c2cfb973 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -3938,6 +3938,24 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p)
 				*tl = txdr_unsigned(NFSV4_CBSLOTS - 1);
 			}
 			break;
+		case NFSV4OP_CBRECALLSLOT:
+			NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
+			highslot = fxdr_unsigned(uint32_t, *tl);
+			NFSLOCKCLSTATE();
+			clp = nfscl_getclntsess(sessionid);
+			if (clp == NULL)
+				error = NFSERR_SERVERFAULT;
+			if (error == 0) {
+				tsep = nfsmnt_mdssession(clp->nfsc_nmp);
+				mtx_lock(&tsep->nfsess_mtx);
+				if ((highslot + 1) < tsep->nfsess_foreslots) {
+					tsep->nfsess_foreslots = (highslot + 1);
+					nfs_resetslots(tsep);
+				}
+				mtx_unlock(&tsep->nfsess_mtx);
+			}
+			NFSUNLOCKCLSTATE();
+			break;
 		default:
 			if (i == 0 && minorvers != NFSV4_MINORVERSION)
 				error = NFSERR_OPNOTINSESS;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502282123.51SLN9M9016666>