diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2011-12-06 08:42:40 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-01-31 19:28:17 -0500 |
commit | ec7652aaf261b7dcb368344369df1e99886c7cd2 (patch) | |
tree | 0d21ca45022adb1221690cb5e368bc17d3f58531 | |
parent | 170942726b16a1dfcc605f0b510b9663b66fa7a3 (diff) |
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: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/inode.c | 6 | ||||
-rw-r--r-- | include/linux/sunrpc/stats.h | 8 | ||||
-rw-r--r-- | net/sunrpc/stats.c | 15 |
3 files changed, 15 insertions, 14 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 65486e652943..d2c760e193f4 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1625,14 +1625,14 @@ static int __init init_nfs_fs(void) | |||
1625 | goto out0; | 1625 | goto out0; |
1626 | 1626 | ||
1627 | #ifdef CONFIG_PROC_FS | 1627 | #ifdef CONFIG_PROC_FS |
1628 | rpc_proc_register(&nfs_rpcstat); | 1628 | rpc_proc_register(&init_net, &nfs_rpcstat); |
1629 | #endif | 1629 | #endif |
1630 | if ((err = register_nfs_fs()) != 0) | 1630 | if ((err = register_nfs_fs()) != 0) |
1631 | goto out; | 1631 | goto out; |
1632 | return 0; | 1632 | return 0; |
1633 | out: | 1633 | out: |
1634 | #ifdef CONFIG_PROC_FS | 1634 | #ifdef CONFIG_PROC_FS |
1635 | rpc_proc_unregister("nfs"); | 1635 | rpc_proc_unregister(&init_net, "nfs"); |
1636 | #endif | 1636 | #endif |
1637 | nfs_destroy_directcache(); | 1637 | nfs_destroy_directcache(); |
1638 | out0: | 1638 | out0: |
@@ -1671,7 +1671,7 @@ static void __exit exit_nfs_fs(void) | |||
1671 | nfs_dns_resolver_destroy(); | 1671 | nfs_dns_resolver_destroy(); |
1672 | nfs_idmap_quit(); | 1672 | nfs_idmap_quit(); |
1673 | #ifdef CONFIG_PROC_FS | 1673 | #ifdef CONFIG_PROC_FS |
1674 | rpc_proc_unregister("nfs"); | 1674 | rpc_proc_unregister(&init_net, "nfs"); |
1675 | #endif | 1675 | #endif |
1676 | nfs_cleanup_cb_ident_idr(); | 1676 | nfs_cleanup_cb_ident_idr(); |
1677 | unregister_nfs_fs(); | 1677 | unregister_nfs_fs(); |
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h index 680471d1f28a..f625b5746bdc 100644 --- a/include/linux/sunrpc/stats.h +++ b/include/linux/sunrpc/stats.h | |||
@@ -58,8 +58,8 @@ void rpc_modcount(struct inode *, int); | |||
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifdef CONFIG_PROC_FS | 60 | #ifdef CONFIG_PROC_FS |
61 | struct proc_dir_entry * rpc_proc_register(struct rpc_stat *); | 61 | struct proc_dir_entry * rpc_proc_register(struct net *,struct rpc_stat *); |
62 | void rpc_proc_unregister(const char *); | 62 | void rpc_proc_unregister(struct net *,const char *); |
63 | void rpc_proc_zero(struct rpc_program *); | 63 | void rpc_proc_zero(struct rpc_program *); |
64 | struct proc_dir_entry * svc_proc_register(struct svc_stat *, | 64 | struct proc_dir_entry * svc_proc_register(struct svc_stat *, |
65 | const struct file_operations *); | 65 | const struct file_operations *); |
@@ -69,8 +69,8 @@ void svc_seq_show(struct seq_file *, | |||
69 | const struct svc_stat *); | 69 | const struct svc_stat *); |
70 | #else | 70 | #else |
71 | 71 | ||
72 | static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; } | 72 | static inline struct proc_dir_entry *rpc_proc_register(struct net *, struct rpc_stat *s) { return NULL; } |
73 | static inline void rpc_proc_unregister(const char *p) {} | 73 | static inline void rpc_proc_unregisterstruct net *, (const char *p) {} |
74 | static inline void rpc_proc_zero(struct rpc_program *p) {} | 74 | static inline void rpc_proc_zero(struct rpc_program *p) {} |
75 | 75 | ||
76 | static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, | 76 | static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, |
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 80df89d957ba..f0f6e7ceadd5 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -213,28 +213,29 @@ EXPORT_SYMBOL_GPL(rpc_print_iostats); | |||
213 | * Register/unregister RPC proc files | 213 | * Register/unregister RPC proc files |
214 | */ | 214 | */ |
215 | static inline struct proc_dir_entry * | 215 | static inline struct proc_dir_entry * |
216 | do_register(const char *name, void *data, const struct file_operations *fops) | 216 | do_register(struct net *net, const char *name, void *data, |
217 | const struct file_operations *fops) | ||
217 | { | 218 | { |
218 | struct sunrpc_net *sn; | 219 | struct sunrpc_net *sn; |
219 | 220 | ||
220 | dprintk("RPC: registering /proc/net/rpc/%s\n", name); | 221 | dprintk("RPC: registering /proc/net/rpc/%s\n", name); |
221 | sn = net_generic(&init_net, sunrpc_net_id); | 222 | sn = net_generic(net, sunrpc_net_id); |
222 | return proc_create_data(name, 0, sn->proc_net_rpc, fops, data); | 223 | return proc_create_data(name, 0, sn->proc_net_rpc, fops, data); |
223 | } | 224 | } |
224 | 225 | ||
225 | struct proc_dir_entry * | 226 | struct proc_dir_entry * |
226 | rpc_proc_register(struct rpc_stat *statp) | 227 | rpc_proc_register(struct net *net, struct rpc_stat *statp) |
227 | { | 228 | { |
228 | return do_register(statp->program->name, statp, &rpc_proc_fops); | 229 | return do_register(net, statp->program->name, statp, &rpc_proc_fops); |
229 | } | 230 | } |
230 | EXPORT_SYMBOL_GPL(rpc_proc_register); | 231 | EXPORT_SYMBOL_GPL(rpc_proc_register); |
231 | 232 | ||
232 | void | 233 | void |
233 | rpc_proc_unregister(const char *name) | 234 | rpc_proc_unregister(struct net *net, const char *name) |
234 | { | 235 | { |
235 | struct sunrpc_net *sn; | 236 | struct sunrpc_net *sn; |
236 | 237 | ||
237 | sn = net_generic(&init_net, sunrpc_net_id); | 238 | sn = net_generic(net, sunrpc_net_id); |
238 | remove_proc_entry(name, sn->proc_net_rpc); | 239 | remove_proc_entry(name, sn->proc_net_rpc); |
239 | } | 240 | } |
240 | EXPORT_SYMBOL_GPL(rpc_proc_unregister); | 241 | EXPORT_SYMBOL_GPL(rpc_proc_unregister); |
@@ -242,7 +243,7 @@ EXPORT_SYMBOL_GPL(rpc_proc_unregister); | |||
242 | struct proc_dir_entry * | 243 | struct proc_dir_entry * |
243 | svc_proc_register(struct svc_stat *statp, const struct file_operations *fops) | 244 | svc_proc_register(struct svc_stat *statp, const struct file_operations *fops) |
244 | { | 245 | { |
245 | return do_register(statp->program->pg_name, statp, fops); | 246 | return do_register(&init_net, statp->program->pg_name, statp, fops); |
246 | } | 247 | } |
247 | EXPORT_SYMBOL_GPL(svc_proc_register); | 248 | EXPORT_SYMBOL_GPL(svc_proc_register); |
248 | 249 | ||