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 26

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

PATCH v4 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        |  5 +++
 fs/nfsd/nfs4callback.c | 75 ++++++++++++++++++++++--------------------
 fs/nfsd/nfsctl.c       |  5 +++
 fs/nfsd/state.h        |  2 ++
 4 files changed, 52 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.
v4:
. fix merge conflict in nfsd_net_exit in nfsd-testing branch.

fs/nfsd/netns.h +5 -0
index 6ad3fe5d7e12..c101bf2c24c2 100644
@@ -228,6 +228,11 @@ struct nfsd_net {
 	struct list_head	local_clients;
 #endif
 	siphash_key_t		*fh_key;
+
+	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 032ab44feb70..5daa647ef0fa 100644
@@ -2216,6 +2216,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;
@@ -2256,6 +2259,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;
 }
 
@@ -2286,6 +2290,7 @@ static __net_exit void nfsd_net_exit(struct net *net)
 	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
 	kfree_sensitive(nn->fh_key);
+	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 9b05462da4cc..490193c1877d 100644
@@ -895,4 +895,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
maintainer
#1 lore raw
Quoted 5 lines · Dai Ngo

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.

The new patch description is rather inferior to the original. Most importantly, it doesn't explain why this change is necessary, but instead simply repeats the content of the diff.

Signature · 1 line
Chuck Lever