Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19f51adc authored by Josef Bacik's avatar Josef Bacik Committed by Greg Kroah-Hartman
Browse files

nfs: make the rpc_stat per net namespace



[ Upstream commit 1548036ef1204df65ca5a16e8b199c858cb80075 ]

Now that we're exposing the rpc stats on a per-network namespace basis,
move this struct into struct nfs_net and use that to make sure only the
per-network namespace stats are exposed.

Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Stable-dep-of: 24457f1be29f ("nfs: Handle error of rpc_proc_register() in nfs_net_init().")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 31dd0cda
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ const struct rpc_program nfs_program = {
	.number			= NFS_PROGRAM,
	.nrvers			= ARRAY_SIZE(nfs_version),
	.version		= nfs_version,
	.stats			= &nfs_rpcstat,
	.pipe_dir_name		= NFS_PIPE_DIRNAME,
};

@@ -492,6 +491,7 @@ int nfs_create_rpc_client(struct nfs_client *clp,
			  const struct nfs_client_initdata *cl_init,
			  rpc_authflavor_t flavor)
{
	struct nfs_net		*nn = net_generic(clp->cl_net, nfs_net_id);
	struct rpc_clnt		*clnt = NULL;
	struct rpc_create_args args = {
		.net		= clp->cl_net,
@@ -503,6 +503,7 @@ int nfs_create_rpc_client(struct nfs_client *clp,
		.servername	= clp->cl_hostname,
		.nodename	= cl_init->nodename,
		.program	= &nfs_program,
		.stats		= &nn->rpcstats,
		.version	= clp->rpc_ops->version,
		.authflavor	= flavor,
		.cred		= cl_init->cred,
@@ -1077,6 +1078,8 @@ void nfs_clients_init(struct net *net)
#endif
	spin_lock_init(&nn->nfs_client_lock);
	nn->boot_time = ktime_get_real();
	memset(&nn->rpcstats, 0, sizeof(nn->rpcstats));
	nn->rpcstats.program = &nfs_program;

	nfs_netns_sysfs_setup(nn, net);
}
+3 −1
Original line number Diff line number Diff line
@@ -2178,8 +2178,10 @@ EXPORT_SYMBOL_GPL(nfs_net_id);

static int nfs_net_init(struct net *net)
{
	struct nfs_net *nn = net_generic(net, nfs_net_id);

	nfs_clients_init(net);
	rpc_proc_register(net, &nfs_rpcstat);
	rpc_proc_register(net, &nn->rpcstats);
	return nfs_fs_proc_net_init(net);
}

+0 −2
Original line number Diff line number Diff line
@@ -405,8 +405,6 @@ struct dentry * nfs_xdev_mount_common(struct file_system_type *, int,
void nfs_kill_super(struct super_block *);
void nfs_fill_super(struct super_block *, struct nfs_mount_info *);

extern struct rpc_stat nfs_rpcstat;

extern int __init register_nfs_fs(void);
extern void __exit unregister_nfs_fs(void);
extern bool nfs_sb_active(struct super_block *sb);
+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/nfs4.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include <linux/sunrpc/stats.h>

struct bl_dev_msg {
	int32_t status;
@@ -34,6 +35,7 @@ struct nfs_net {
	struct nfs_netns_client *nfs_client;
	spinlock_t nfs_client_lock;
	ktime_t boot_time;
	struct rpc_stat rpcstats;
#ifdef CONFIG_PROC_FS
	struct proc_dir_entry *proc_nfsfs;
#endif