Commit ec7652aa authored by Stanislav Kinsbursky's avatar Stanislav Kinsbursky Committed by Trond Myklebust

SUNRPC: register RPC stats /proc entries in passed network namespace context

This patch makes it possible to create NFS program entry ("/proc/net/rpc/nfs")
in passed network namespace context instead of hard-coded "init_net".
Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 17094272
...@@ -1625,14 +1625,14 @@ static int __init init_nfs_fs(void) ...@@ -1625,14 +1625,14 @@ static int __init init_nfs_fs(void)
goto out0; goto out0;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
rpc_proc_register(&nfs_rpcstat); rpc_proc_register(&init_net, &nfs_rpcstat);
#endif #endif
if ((err = register_nfs_fs()) != 0) if ((err = register_nfs_fs()) != 0)
goto out; goto out;
return 0; return 0;
out: out:
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
rpc_proc_unregister("nfs"); rpc_proc_unregister(&init_net, "nfs");
#endif #endif
nfs_destroy_directcache(); nfs_destroy_directcache();
out0: out0:
...@@ -1671,7 +1671,7 @@ static void __exit exit_nfs_fs(void) ...@@ -1671,7 +1671,7 @@ static void __exit exit_nfs_fs(void)
nfs_dns_resolver_destroy(); nfs_dns_resolver_destroy();
nfs_idmap_quit(); nfs_idmap_quit();
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
rpc_proc_unregister("nfs"); rpc_proc_unregister(&init_net, "nfs");
#endif #endif
nfs_cleanup_cb_ident_idr(); nfs_cleanup_cb_ident_idr();
unregister_nfs_fs(); unregister_nfs_fs();
......
...@@ -58,8 +58,8 @@ void rpc_modcount(struct inode *, int); ...@@ -58,8 +58,8 @@ void rpc_modcount(struct inode *, int);
#endif #endif
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
struct proc_dir_entry * rpc_proc_register(struct rpc_stat *); struct proc_dir_entry * rpc_proc_register(struct net *,struct rpc_stat *);
void rpc_proc_unregister(const char *); void rpc_proc_unregister(struct net *,const char *);
void rpc_proc_zero(struct rpc_program *); void rpc_proc_zero(struct rpc_program *);
struct proc_dir_entry * svc_proc_register(struct svc_stat *, struct proc_dir_entry * svc_proc_register(struct svc_stat *,
const struct file_operations *); const struct file_operations *);
...@@ -69,8 +69,8 @@ void svc_seq_show(struct seq_file *, ...@@ -69,8 +69,8 @@ void svc_seq_show(struct seq_file *,
const struct svc_stat *); const struct svc_stat *);
#else #else
static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; } static inline struct proc_dir_entry *rpc_proc_register(struct net *, struct rpc_stat *s) { return NULL; }
static inline void rpc_proc_unregister(const char *p) {} static inline void rpc_proc_unregisterstruct net *, (const char *p) {}
static inline void rpc_proc_zero(struct rpc_program *p) {} static inline void rpc_proc_zero(struct rpc_program *p) {}
static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s,
......
...@@ -213,28 +213,29 @@ EXPORT_SYMBOL_GPL(rpc_print_iostats); ...@@ -213,28 +213,29 @@ EXPORT_SYMBOL_GPL(rpc_print_iostats);
* Register/unregister RPC proc files * Register/unregister RPC proc files
*/ */
static inline struct proc_dir_entry * static inline struct proc_dir_entry *
do_register(const char *name, void *data, const struct file_operations *fops) do_register(struct net *net, const char *name, void *data,
const struct file_operations *fops)
{ {
struct sunrpc_net *sn; struct sunrpc_net *sn;
dprintk("RPC: registering /proc/net/rpc/%s\n", name); dprintk("RPC: registering /proc/net/rpc/%s\n", name);
sn = net_generic(&init_net, sunrpc_net_id); sn = net_generic(net, sunrpc_net_id);
return proc_create_data(name, 0, sn->proc_net_rpc, fops, data); return proc_create_data(name, 0, sn->proc_net_rpc, fops, data);
} }
struct proc_dir_entry * struct proc_dir_entry *
rpc_proc_register(struct rpc_stat *statp) rpc_proc_register(struct net *net, struct rpc_stat *statp)
{ {
return do_register(statp->program->name, statp, &rpc_proc_fops); return do_register(net, statp->program->name, statp, &rpc_proc_fops);
} }
EXPORT_SYMBOL_GPL(rpc_proc_register); EXPORT_SYMBOL_GPL(rpc_proc_register);
void void
rpc_proc_unregister(const char *name) rpc_proc_unregister(struct net *net, const char *name)
{ {
struct sunrpc_net *sn; struct sunrpc_net *sn;
sn = net_generic(&init_net, sunrpc_net_id); sn = net_generic(net, sunrpc_net_id);
remove_proc_entry(name, sn->proc_net_rpc); remove_proc_entry(name, sn->proc_net_rpc);
} }
EXPORT_SYMBOL_GPL(rpc_proc_unregister); EXPORT_SYMBOL_GPL(rpc_proc_unregister);
...@@ -242,7 +243,7 @@ EXPORT_SYMBOL_GPL(rpc_proc_unregister); ...@@ -242,7 +243,7 @@ EXPORT_SYMBOL_GPL(rpc_proc_unregister);
struct proc_dir_entry * struct proc_dir_entry *
svc_proc_register(struct svc_stat *statp, const struct file_operations *fops) svc_proc_register(struct svc_stat *statp, const struct file_operations *fops)
{ {
return do_register(statp->program->pg_name, statp, fops); return do_register(&init_net, statp->program->pg_name, statp, fops);
} }
EXPORT_SYMBOL_GPL(svc_proc_register); EXPORT_SYMBOL_GPL(svc_proc_register);
......
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