Skip to content

Commit d47151b

Browse files
josefbacikTrond Myklebust
authored and
Trond Myklebust
committed
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: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 2057a48 commit d47151b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/nfs/inode.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,11 +2427,13 @@ EXPORT_SYMBOL_GPL(nfs_net_id);
24272427
static int nfs_net_init(struct net *net)
24282428
{
24292429
nfs_clients_init(net);
2430+
rpc_proc_register(net, &nfs_rpcstat);
24302431
return nfs_fs_proc_net_init(net);
24312432
}
24322433

24332434
static void nfs_net_exit(struct net *net)
24342435
{
2436+
rpc_proc_unregister(net, "nfs");
24352437
nfs_fs_proc_net_exit(net);
24362438
nfs_clients_exit(net);
24372439
}
@@ -2486,15 +2488,12 @@ static int __init init_nfs_fs(void)
24862488
if (err)
24872489
goto out1;
24882490

2489-
rpc_proc_register(&init_net, &nfs_rpcstat);
2490-
24912491
err = register_nfs_fs();
24922492
if (err)
24932493
goto out0;
24942494

24952495
return 0;
24962496
out0:
2497-
rpc_proc_unregister(&init_net, "nfs");
24982497
nfs_destroy_directcache();
24992498
out1:
25002499
nfs_destroy_writepagecache();
@@ -2524,7 +2523,6 @@ static void __exit exit_nfs_fs(void)
25242523
nfs_destroy_inodecache();
25252524
nfs_destroy_nfspagecache();
25262525
unregister_pernet_subsys(&nfs_net_ops);
2527-
rpc_proc_unregister(&init_net, "nfs");
25282526
unregister_nfs_fs();
25292527
nfs_fs_proc_exit();
25302528
nfsiod_stop();

0 commit comments

Comments
 (0)