nfsd: Clean up the "glue" for the nfsrdma.ko module

Move svc_reg() calls into a helper function so that the nfsrdma.ko
can call that.  Create a new nfs_extern.h as a place to put the
nfs stuff that server side NFS over RDMA needs to access, with a
prototype for the helper function and a couple of definitions that
probably shouldn't be in svc.h.

No semantics change.

MFC after:	3 months
Fixes:	7144a1d58c ("nfsd: Add glue for the nfsrdma.ko module")
This commit is contained in:
Rick Macklem committed 2026-09-06 13:40:34 -07:00
1 parent e801894294
commit 407d717705
3 files changed
+18 -14

No files matched your search

+17 -11
View File
@@ -39,6 +39,7 @@
#include "opt_kern_tls.h"
#include <fs/nfs/nfsport.h>
#include <fs/nfs/nfs_extern.h>
#include <rpc/rpc.h>
#include <rpc/rpcsec_gss.h>
@@ -105,7 +106,6 @@ static int nfs_proc(struct nfsrv_descript *, u_int32_t, SVCXPRT *xprt,
struct nfsrvcache **);
extern u_long sb_max_adj;
extern int newnfs_numnfsd;
extern time_t nfsdev_time;
extern int nfsrv_writerpc[NFS_NPROCS];
extern volatile int nfsrv_devidcnt;
@@ -554,6 +554,21 @@ nfssvc_loss(SVCXPRT *xprt)
CURVNET_RESTORE();
}
/*
* Register xprt with the correct versions of NFS.
*/
void
nfsrv_svc_reg(SVCXPRT *xprt)
{
if (VNET(nfs_minvers) == NFS_VER2)
svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program, NULL);
if (VNET(nfs_minvers) <= NFS_VER3 && VNET(nfs_maxvers) >= NFS_VER3)
svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program, NULL);
if (VNET(nfs_maxvers) >= NFS_VER4)
svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, NULL);
}
/*
* Adds a socket to the list for servicing by nfsds.
*/
@@ -585,16 +600,7 @@ nfsrvd_addsock(struct file *fp)
fp->f_ops = &badfileops;
fp->f_data = NULL;
xprt->xp_sockref = ++sockref;
if (VNET(nfs_minvers) == NFS_VER2)
svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program,
NULL);
if (VNET(nfs_minvers) <= NFS_VER3 &&
VNET(nfs_maxvers) >= NFS_VER3)
svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program,
NULL);
if (VNET(nfs_maxvers) >= NFS_VER4)
svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program,
NULL);
nfsrv_svc_reg(xprt);
if (so->so_type == SOCK_STREAM)
svc_loss_reg(xprt, nfssvc_loss);
SVC_RELEASE(xprt);
+1 -1
View File
@@ -43,6 +43,7 @@
*/
#include <fs/nfs/nfsport.h>
#include <fs/nfs/nfs_extern.h>
#include <security/mac/mac_framework.h>
#include <sys/callout.h>
#include <sys/filio.h>
@@ -59,7 +60,6 @@ FEATURE(nfsd, "NFSv4 server");
extern u_int32_t newnfs_true, newnfs_false, newnfs_xdrneg1;
extern int nfsrv_useacl;
extern int newnfs_numnfsd;
extern int nfsrv_sessionhashsize;
extern struct nfslayouthash *nfslayouthash;
extern int nfsrv_layouthashsize;
-2
View File
@@ -350,8 +350,6 @@ typedef struct __rpc_svcpool {
*/
typedef int svc_rdma_listen_ftype(SVCPOOL *pool, int port);
extern svc_rdma_listen_ftype *svc_rdma_listen;
extern int nfsrvd_rdma_port;
extern int newnfs_numnfsd;
/*
* Operations defined on an SVCXPRT handle