Commit d47151b7 authored by Josef Bacik's avatar Josef Bacik Committed by Trond Myklebust

nfs: expose /proc/net/sunrpc/nfs in net namespaces

We're using nfs mounts inside of containers in production and noticed
that the nfs stats are not exposed in /proc.  This is a problem for us
as we use these stats for monitoring, and have to do this awkward bind
mount from the main host into the container in order to get to these
states.

Add the rpc_proc_register call to the pernet operations entry and exit
points so these stats can be exposed inside of network namespaces.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 2057a48d
...@@ -2427,11 +2427,13 @@ EXPORT_SYMBOL_GPL(nfs_net_id); ...@@ -2427,11 +2427,13 @@ EXPORT_SYMBOL_GPL(nfs_net_id);
static int nfs_net_init(struct net *net) static int nfs_net_init(struct net *net)
{ {
nfs_clients_init(net); nfs_clients_init(net);
rpc_proc_register(net, &nfs_rpcstat);
return nfs_fs_proc_net_init(net); return nfs_fs_proc_net_init(net);
} }
static void nfs_net_exit(struct net *net) static void nfs_net_exit(struct net *net)
{ {
rpc_proc_unregister(net, "nfs");
nfs_fs_proc_net_exit(net); nfs_fs_proc_net_exit(net);
nfs_clients_exit(net); nfs_clients_exit(net);
} }
...@@ -2486,15 +2488,12 @@ static int __init init_nfs_fs(void) ...@@ -2486,15 +2488,12 @@ static int __init init_nfs_fs(void)
if (err) if (err)
goto out1; goto out1;
rpc_proc_register(&init_net, &nfs_rpcstat);
err = register_nfs_fs(); err = register_nfs_fs();
if (err) if (err)
goto out0; goto out0;
return 0; return 0;
out0: out0:
rpc_proc_unregister(&init_net, "nfs");
nfs_destroy_directcache(); nfs_destroy_directcache();
out1: out1:
nfs_destroy_writepagecache(); nfs_destroy_writepagecache();
...@@ -2524,7 +2523,6 @@ static void __exit exit_nfs_fs(void) ...@@ -2524,7 +2523,6 @@ static void __exit exit_nfs_fs(void)
nfs_destroy_inodecache(); nfs_destroy_inodecache();
nfs_destroy_nfspagecache(); nfs_destroy_nfspagecache();
unregister_pernet_subsys(&nfs_net_ops); unregister_pernet_subsys(&nfs_net_ops);
rpc_proc_unregister(&init_net, "nfs");
unregister_nfs_fs(); unregister_nfs_fs();
nfs_fs_proc_exit(); nfs_fs_proc_exit();
nfsiod_stop(); nfsiod_stop();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment