Skip to content

Commit b6d60ba

Browse files
josefbaciksmb49
authored andcommitted
nfs: expose /proc/net/sunrpc/nfs in net namespaces
BugLink: https://bugs.launchpad.net/bugs/2070028 [ Upstream commit d47151b ] 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> Stable-dep-of: 24457f1 ("nfs: Handle error of rpc_proc_register() in nfs_net_init().") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 33c800a commit b6d60ba

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
@@ -2361,11 +2361,13 @@ EXPORT_SYMBOL_GPL(nfs_net_id);
23612361
static int nfs_net_init(struct net *net)
23622362
{
23632363
nfs_clients_init(net);
2364+
rpc_proc_register(net, &nfs_rpcstat);
23642365
return nfs_fs_proc_net_init(net);
23652366
}
23662367

23672368
static void nfs_net_exit(struct net *net)
23682369
{
2370+
rpc_proc_unregister(net, "nfs");
23692371
nfs_fs_proc_net_exit(net);
23702372
nfs_clients_exit(net);
23712373
}
@@ -2424,15 +2426,12 @@ static int __init init_nfs_fs(void)
24242426
if (err)
24252427
goto out1;
24262428

2427-
rpc_proc_register(&init_net, &nfs_rpcstat);
2428-
24292429
err = register_nfs_fs();
24302430
if (err)
24312431
goto out0;
24322432

24332433
return 0;
24342434
out0:
2435-
rpc_proc_unregister(&init_net, "nfs");
24362435
nfs_destroy_directcache();
24372436
out1:
24382437
nfs_destroy_writepagecache();
@@ -2465,7 +2464,6 @@ static void __exit exit_nfs_fs(void)
24652464
nfs_destroy_nfspagecache();
24662465
nfs_fscache_unregister();
24672466
unregister_pernet_subsys(&nfs_net_ops);
2468-
rpc_proc_unregister(&init_net, "nfs");
24692467
unregister_nfs_fs();
24702468
nfs_fs_proc_exit();
24712469
nfsiod_stop();

0 commit comments

Comments
 (0)