Skip to contentSkip to conversation

NFSD: move accumulated callback ops to per-net namespace

PATCH Superseded Dai Ngo 1 participant 1 message Feb 25

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

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

Track accumulated callback operations on a per-network-namespace basis instead of globally, ensuring proper isolation and behavior when running nfsd in containers.

---
 fs/nfsd/netns.h        |  4 +++
 fs/nfsd/nfs4callback.c | 75 ++++++++++++++++++++++--------------------
 fs/nfsd/nfsctl.c       |  4 +++
 fs/nfsd/state.h        |  2 ++
 4 files changed, 50 insertions(+), 35 deletions(-)
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 +4 -0
index e9acd2cd602c..b6f5a7822cd3 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)
+		goto out_export_error;
 	retval = nfsd_export_init(net);
 	if (retval)
 		goto out_export_error;
@@ -2227,6 +2230,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_exit(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..30d3ff1a4ad7 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_exit(struct nfsd_net *nn);
 #endif   /* NFSD4_STATE_H */
Signature · 1 line
2.47.3