nfscl: Yet more fixes for the NFS over RDMA client glue

Yet again.  I was trying to make the svc_vc_backchannel()
operations do double duty and be used by the clnt_rdma.c code
as well.  It got too messy, so this reverts svc_vc.c back to
its pre-glue form and adds the small changes needed to support
a separate set of svc_rdma_backchannel_xxx() functions.

This commit should not affect non-RDMA behaviour.

MFC after:	3 months
Fixes:	884ee8d6c9 ("nfscl: Add some glue for client side NFS over RDMA")
This commit is contained in:
Rick Macklem committed 2026-09-13 17:12:46 -07:00
1 parent 9a46a1439c
commit 77535f91f6
5 files changed
+18 -21

No files matched your search

+12 -7
View File
@@ -492,11 +492,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp,
CLNT_CONTROL(client, CLSET_TLS, &one);
} else {
/* RDMA. */
if (NFSHASNFSV4N(nmp) && cred != NULL) {
if (NFSHASNFSV4N(nmp) && cred != NULL &&
svc_rdma_create_backchannel_call != NULL) {
/*
* Set up the backchannel. svc_vc_create_backchannel()
* is sufficient. The rdma boolean in conn_cf will get
* set by the CLSET_BACKCHANNEL control.
* Set up the backchannel.
*/
/*
* Make sure the nfscbd_pool doesn't get
@@ -506,7 +505,8 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp,
if (nfs_numnfscbd > 0) {
nfs_numnfscbd++;
NFSD_UNLOCK();
xprt = svc_vc_create_backchannel(nfscbd_pool);
xprt = svc_rdma_create_backchannel_call(
nfscbd_pool);
CLNT_CONTROL(client, CLSET_BACKCHANNEL, xprt);
NFSD_LOCK();
nfs_numnfscbd--;
@@ -734,7 +734,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
struct ucred *authcred, *savcred;
struct nfsclsession *sep;
uint8_t sessionid[NFSX_V4SESSIONID];
bool nextconn_set;
bool nextconn_set, has_mreduce;
struct timespec trylater_delay, ts, waituntil;
/* Initially 1msec. */
@@ -749,6 +749,10 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
return (ESTALE);
}
has_mreduce = false;
if (nmp != NULL && NFSHASRDMA(nmp) &&
(nd->nd_mreq->m_flags & M_PROTO11) != 0)
has_mreduce = true;
/*
* Set authcred, which is used to acquire RPC credentials to
* the cred argument, by default. The crhold() should not be
@@ -1536,7 +1540,8 @@ out:
}
#endif
rpc_remove_mreduce(nd->nd_mreq, false); /* Will be free'd by caller. */
if (has_mreduce)
rpc_remove_mreduce(nd->nd_mreq, false);
m_freem(nd->nd_mreq);
if (usegssname == 0)
AUTH_DESTROY(auth);
+1 -1
View File
@@ -51,7 +51,7 @@
xprt_rdma_check_route_ftype *rdma_check_route = NULL;
clnt_rdma_create_ftype *clnt_rdma_create_call = NULL;
clnt_rdma_bcksend_ftype *clnt_rdma_bcksend_call = NULL;
svc_rdma_create_backchannel_ftype *svc_rdma_create_backchannel_call = NULL;
static enum clnt_stat clnt_reconnect_call(CLIENT *, struct rpc_callextra *,
rpcproc_t, struct mbuf *, struct mbuf **, struct timeval);
+2 -3
View File
@@ -51,8 +51,8 @@ typedef int xprt_rdma_check_route_ftype(struct vnet *vnet,
struct sockaddr *dstaddr, uint32_t cbslots);
extern xprt_rdma_check_route_ftype *rdma_check_route;
typedef bool_t clnt_rdma_bcksend_ftype(SVCXPRT *xprt, struct mbuf *m);
extern clnt_rdma_bcksend_ftype *clnt_rdma_bcksend_call;
typedef SVCXPRT *svc_rdma_create_backchannel_ftype(SVCPOOL *nfscbdool);
extern svc_rdma_create_backchannel_ftype *svc_rdma_create_backchannel_call;
typedef CLIENT *clnt_rdma_create_ftype(struct sockaddr *raddr,
const rpcprog_t prog, const rpcvers_t vers, int intrflag,
@@ -153,7 +153,6 @@ struct cf_conn { /* kept in xprt->xp_p1 for actual connection */
struct mbuf *mreq; /* current record being built from mpending */
uint32_t resid; /* number of bytes needed for fragment */
bool_t eor; /* reading last fragment of current record */
bool_t rdma; /* On an RDMA connection. */
};
void rpcnl_init(void);
+1
View File
@@ -617,6 +617,7 @@ extern SVCXPRT *svc_vc_create(SVCPOOL *, struct socket *,
*/
extern SVCXPRT *svc_vc_create_backchannel(SVCPOOL *);
extern SVCXPRT *svc_rdma_create_backchannel(SVCPOOL *);
extern void *clnt_bck_create(struct socket *, const rpcprog_t, const rpcvers_t);
/*
+2 -10
View File
@@ -1063,7 +1063,6 @@ svc_vc_backchannel_reply(SVCXPRT *xprt, struct rpc_msg *msg,
struct sockaddr *addr, struct mbuf *m, uint32_t *seq)
{
struct ct_data *ct;
struct cf_conn *cd = (struct cf_conn *)xprt->xp_p1;
XDR xdrs;
struct mbuf *mrep;
bool_t stat = TRUE;
@@ -1076,8 +1075,7 @@ svc_vc_backchannel_reply(SVCXPRT *xprt, struct rpc_msg *msg,
* Leave space for record mark.
*/
mrep = m_gethdr(M_WAITOK, MT_DATA);
if (!cd->rdma)
mrep->m_data += sizeof(uint32_t);
mrep->m_data += sizeof(uint32_t);
xdrmbuf_create(&xdrs, mrep, XDR_ENCODE);
@@ -1091,13 +1089,7 @@ svc_vc_backchannel_reply(SVCXPRT *xprt, struct rpc_msg *msg,
stat = xdr_replymsg(&xdrs, msg);
}
if (stat && cd->rdma) {
KASSERT(clnt_rdma_bcksend_call != NULL,
("svc_vc_backchannel_reply: RDMA set, but "
"clnt_rdma_bcksend_call NULL"));
stat = clnt_rdma_bcksend_call(xprt, mrep);
} else if (stat) {
if (stat) {
m_fixhdr(mrep);
/*