Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Josef Bacik and committed by
Trond Myklebust
d47151b7 2057a48d

+2 -4
+2 -4
fs/nfs/inode.c
··· 2427 2427 static int nfs_net_init(struct net *net) 2428 2428 { 2429 2429 nfs_clients_init(net); 2430 + rpc_proc_register(net, &nfs_rpcstat); 2430 2431 return nfs_fs_proc_net_init(net); 2431 2432 } 2432 2433 2433 2434 static void nfs_net_exit(struct net *net) 2434 2435 { 2436 + rpc_proc_unregister(net, "nfs"); 2435 2437 nfs_fs_proc_net_exit(net); 2436 2438 nfs_clients_exit(net); 2437 2439 } ··· 2488 2486 if (err) 2489 2487 goto out1; 2490 2488 2491 - rpc_proc_register(&init_net, &nfs_rpcstat); 2492 - 2493 2489 err = register_nfs_fs(); 2494 2490 if (err) 2495 2491 goto out0; 2496 2492 2497 2493 return 0; 2498 2494 out0: 2499 - rpc_proc_unregister(&init_net, "nfs"); 2500 2495 nfs_destroy_directcache(); 2501 2496 out1: 2502 2497 nfs_destroy_writepagecache(); ··· 2523 2524 nfs_destroy_inodecache(); 2524 2525 nfs_destroy_nfspagecache(); 2525 2526 unregister_pernet_subsys(&nfs_net_ops); 2526 - rpc_proc_unregister(&init_net, "nfs"); 2527 2527 unregister_nfs_fs(); 2528 2528 nfs_fs_proc_exit(); 2529 2529 nfsiod_stop();