Skip to contentSkip to conversation

NFSD: move accumulated callback ops to per-net namespace

PATCH Superseded Dai Ngo 2 participants 2 messages Feb 25 – Feb 27

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

PATCH v3 1/1 NFSD: move accumulated callback ops to per-net namespace

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.

---
 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.

fs/nfsd/netns.h +4 -0
index 9fa600602658..62a5949490ea 100644
@@ -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 */
fs/nfsd/nfs4callback.c +40 -35

104 lines not on this page · raw message

fs/nfsd/nfsctl.c +5 -0
index e9acd2cd602c..b24a838afcaa 100644
@@ -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);
fs/nfsd/state.h +2 -0
index 6fcbf1e427d4..72d98088627a 100644
@@ -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 */
Signature · 1 line
2.47.3
#1 lore raw
kernel test robot noticed the following build errors:

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/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260227/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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!
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki