* [PATCH v3 1/1] NFSD: move accumulated callback ops to per-net namespace
@ 2026-02-25 17:26 Dai Ngo
2026-02-27 14:20 ` kernel test robot
0 siblings, 1 reply; 2+ messages in thread
From: Dai Ngo @ 2026-02-25 17:26 UTC (permalink / raw)
To: chuck.lever, jlayton, neil, okorniev, tom, hch; +Cc: linux-nfs
Moves the callback RPC program, version, and stats structures from
global statics into struct nfsd_net so that each network namespace
gets its own callback counters and program definition.
Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
fs/nfsd/netns.h | 4 +++
fs/nfsd/nfs4callback.c | 75 ++++++++++++++++++++++--------------------
fs/nfsd/nfsctl.c | 5 +++
fs/nfsd/state.h | 2 ++
4 files changed, 51 insertions(+), 35 deletions(-)
v2:
. free memory allocated for nn->nfsd_cb_version4.counts in
nfsd_net_cb_stats_init() on error in nfsd_net_init().
v3:
. reword commit message.
. fix initialization of nn->nfsd_cb_program.nrvers.
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index 9fa600602658..62a5949490ea 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -224,6 +224,10 @@ struct nfsd_net {
spinlock_t local_clients_lock;
struct list_head local_clients;
#endif
+ struct rpc_version nfsd_cb_version4;
+ const struct rpc_version *nfsd_cb_versions[2];
+ struct rpc_program nfsd_cb_program;
+ struct rpc_stat nfsd_cb_stat;
};
/* Simple check to find out if a given net was properly initialized */
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index aea8bdd2fdc4..759f24657c34 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -1016,7 +1016,7 @@ static int nfs4_xdr_dec_cb_offload(struct rpc_rqst *rqstp,
.p_decode = nfs4_xdr_dec_##restype, \
.p_arglen = NFS4_enc_##argtype##_sz, \
.p_replen = NFS4_dec_##restype##_sz, \
- .p_statidx = NFSPROC4_CB_##call, \
+ .p_statidx = NFSPROC4_CLNT_##proc, \
.p_name = #proc, \
}
@@ -1032,40 +1032,7 @@ static const struct rpc_procinfo nfs4_cb_procedures[] = {
PROC(CB_GETATTR, COMPOUND, cb_getattr, cb_getattr),
};
-static unsigned int nfs4_cb_counts[ARRAY_SIZE(nfs4_cb_procedures)];
-static const struct rpc_version nfs_cb_version4 = {
-/*
- * Note on the callback rpc program version number: despite language in rfc
- * 5661 section 18.36.3 requiring servers to use 4 in this field, the
- * official xdr descriptions for both 4.0 and 4.1 specify version 1, and
- * in practice that appears to be what implementations use. The section
- * 18.36.3 language is expected to be fixed in an erratum.
- */
- .number = 1,
- .nrprocs = ARRAY_SIZE(nfs4_cb_procedures),
- .procs = nfs4_cb_procedures,
- .counts = nfs4_cb_counts,
-};
-
-static const struct rpc_version *nfs_cb_version[2] = {
- [1] = &nfs_cb_version4,
-};
-
-static const struct rpc_program cb_program;
-
-static struct rpc_stat cb_stats = {
- .program = &cb_program
-};
-
#define NFS4_CALLBACK 0x40000000
-static const struct rpc_program cb_program = {
- .name = "nfs4_cb",
- .number = NFS4_CALLBACK,
- .nrvers = ARRAY_SIZE(nfs_cb_version),
- .version = nfs_cb_version,
- .stats = &cb_stats,
- .pipe_dir_name = "nfsd4_cb",
-};
static int max_cb_time(struct net *net)
{
@@ -1152,14 +1119,15 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
.addrsize = conn->cb_addrlen,
.saddress = (struct sockaddr *) &conn->cb_saddr,
.timeout = &timeparms,
- .program = &cb_program,
.version = 1,
.flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET),
.cred = current_cred(),
};
struct rpc_clnt *client;
const struct cred *cred;
+ struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
+ args.program = &nn->nfsd_cb_program;
if (clp->cl_minorversion == 0) {
if (!clp->cl_cred.cr_principal &&
(clp->cl_cred.cr_flavor >= RPC_AUTH_GSS_KRB5)) {
@@ -1786,3 +1754,40 @@ bool nfsd4_run_cb(struct nfsd4_callback *cb)
nfsd41_cb_inflight_end(clp);
return queued;
}
+
+void nfsd_net_cb_stats_shutdown(struct nfsd_net *nn)
+{
+ kfree(nn->nfsd_cb_version4.counts);
+}
+
+int nfsd_net_cb_stats_init(struct nfsd_net *nn)
+{
+ nn->nfsd_cb_version4.counts = kzalloc_objs(unsigned int,
+ ARRAY_SIZE(nfs4_cb_procedures), GFP_KERNEL);
+ if (!nn->nfsd_cb_version4.counts)
+ return -ENOMEM;
+ /*
+ * Note on the callback rpc program version number: despite language
+ * in rfc 5661 section 18.36.3 requiring servers to use 4 in this
+ * field, the official xdr descriptions for both 4.0 and 4.1 specify
+ * version 1, and in practice that appears to be what implementations
+ * use. The section 18.36.3 language is expected to be fixed in an
+ * erratum.
+ */
+ nn->nfsd_cb_version4.number = 1;
+
+ nn->nfsd_cb_version4.nrprocs = ARRAY_SIZE(nfs4_cb_procedures);
+ nn->nfsd_cb_version4.procs = nfs4_cb_procedures;
+ nn->nfsd_cb_versions[1] = &nn->nfsd_cb_version4;
+
+ memset(&nn->nfsd_cb_stat, 0, sizeof(nn->nfsd_cb_stat));
+ nn->nfsd_cb_program.name = "nfs4_cb";
+ nn->nfsd_cb_program.number = NFS4_CALLBACK;
+ nn->nfsd_cb_program.nrvers = ARRAY_SIZE(nn->nfsd_cb_versions);
+ nn->nfsd_cb_program.version = &nn->nfsd_cb_versions[0];
+ nn->nfsd_cb_program.pipe_dir_name = "nfsd4_cb";
+ nn->nfsd_cb_program.stats = &nn->nfsd_cb_stat;
+ nn->nfsd_cb_stat.program = &nn->nfsd_cb_program;
+
+ return 0;
+}
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index e9acd2cd602c..b24a838afcaa 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -2158,6 +2158,9 @@ static __net_init int nfsd_net_init(struct net *net)
int retval;
int i;
+ retval = nfsd_net_cb_stats_init(nn);
+ if (retval)
+ return retval;
retval = nfsd_export_init(net);
if (retval)
goto out_export_error;
@@ -2198,6 +2201,7 @@ static __net_init int nfsd_net_init(struct net *net)
out_idmap_error:
nfsd_export_shutdown(net);
out_export_error:
+ nfsd_net_cb_stats_shutdown(nn);
return retval;
}
@@ -2227,6 +2231,7 @@ static __net_exit void nfsd_net_exit(struct net *net)
{
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
+ nfsd_net_cb_stats_shutdown(nn);
nfsd_proc_stat_shutdown(net);
percpu_counter_destroy_many(nn->counter, NFSD_STATS_COUNTERS_NUM);
nfsd_idmap_shutdown(net);
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 6fcbf1e427d4..72d98088627a 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -877,4 +877,6 @@ struct nfsd4_get_dir_delegation;
struct nfs4_delegation *nfsd_get_dir_deleg(struct nfsd4_compound_state *cstate,
struct nfsd4_get_dir_delegation *gdd,
struct nfsd_file *nf);
+int nfsd_net_cb_stats_init(struct nfsd_net *nn);
+void nfsd_net_cb_stats_shutdown(struct nfsd_net *nn);
#endif /* NFSD4_STATE_H */
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3 1/1] NFSD: move accumulated callback ops to per-net namespace
2026-02-25 17:26 [PATCH v3 1/1] NFSD: move accumulated callback ops to per-net namespace Dai Ngo
@ 2026-02-27 14:20 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-02-27 14:20 UTC (permalink / raw)
To: Dai Ngo, chuck.lever, jlayton, neil, okorniev, tom, hch
Cc: oe-kbuild-all, linux-nfs
Hi Dai,
kernel test robot noticed the following build errors:
[auto build test ERROR on brauner-vfs/vfs.all]
[also build test ERROR on linus/master v7.0-rc1 next-20260226]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Dai-Ngo/NFSD-move-accumulated-callback-ops-to-per-net-namespace/20260226-012940
base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link: https://lore.kernel.org/r/20260225172624.707224-1-dai.ngo%40oracle.com
patch subject: [PATCH v3 1/1] NFSD: move accumulated callback ops to per-net namespace
config: parisc-randconfig-002-20260227 (https://download.01.org/0day-ci/archive/20260227/202602272240.e34pGKuR-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260227/202602272240.e34pGKuR-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602272240.e34pGKuR-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "nfsd_net_cb_stats_shutdown" [fs/nfsd/nfsd.ko] undefined!
>> ERROR: modpost: "nfsd_net_cb_stats_init" [fs/nfsd/nfsd.ko] undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-27 14:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 17:26 [PATCH v3 1/1] NFSD: move accumulated callback ops to per-net namespace Dai Ngo
2026-02-27 14:20 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox