diff options
Diffstat (limited to 'net/sunrpc/stats.c')
-rw-r--r-- | net/sunrpc/stats.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index ea1046f3f9a3..80df89d957ba 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -22,11 +22,10 @@ | |||
22 | #include <linux/sunrpc/clnt.h> | 22 | #include <linux/sunrpc/clnt.h> |
23 | #include <linux/sunrpc/svcsock.h> | 23 | #include <linux/sunrpc/svcsock.h> |
24 | #include <linux/sunrpc/metrics.h> | 24 | #include <linux/sunrpc/metrics.h> |
25 | #include <net/net_namespace.h> | ||
26 | 25 | ||
27 | #define RPCDBG_FACILITY RPCDBG_MISC | 26 | #include "netns.h" |
28 | 27 | ||
29 | struct proc_dir_entry *proc_net_rpc = NULL; | 28 | #define RPCDBG_FACILITY RPCDBG_MISC |
30 | 29 | ||
31 | /* | 30 | /* |
32 | * Get RPC client stats | 31 | * Get RPC client stats |
@@ -116,9 +115,7 @@ EXPORT_SYMBOL_GPL(svc_seq_show); | |||
116 | */ | 115 | */ |
117 | struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) | 116 | struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) |
118 | { | 117 | { |
119 | struct rpc_iostats *new; | 118 | return kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL); |
120 | new = kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL); | ||
121 | return new; | ||
122 | } | 119 | } |
123 | EXPORT_SYMBOL_GPL(rpc_alloc_iostats); | 120 | EXPORT_SYMBOL_GPL(rpc_alloc_iostats); |
124 | 121 | ||
@@ -218,10 +215,11 @@ EXPORT_SYMBOL_GPL(rpc_print_iostats); | |||
218 | static inline struct proc_dir_entry * | 215 | static inline struct proc_dir_entry * |
219 | do_register(const char *name, void *data, const struct file_operations *fops) | 216 | do_register(const char *name, void *data, const struct file_operations *fops) |
220 | { | 217 | { |
221 | rpc_proc_init(); | 218 | struct sunrpc_net *sn; |
222 | dprintk("RPC: registering /proc/net/rpc/%s\n", name); | ||
223 | 219 | ||
224 | return proc_create_data(name, 0, proc_net_rpc, fops, data); | 220 | dprintk("RPC: registering /proc/net/rpc/%s\n", name); |
221 | sn = net_generic(&init_net, sunrpc_net_id); | ||
222 | return proc_create_data(name, 0, sn->proc_net_rpc, fops, data); | ||
225 | } | 223 | } |
226 | 224 | ||
227 | struct proc_dir_entry * | 225 | struct proc_dir_entry * |
@@ -234,7 +232,10 @@ EXPORT_SYMBOL_GPL(rpc_proc_register); | |||
234 | void | 232 | void |
235 | rpc_proc_unregister(const char *name) | 233 | rpc_proc_unregister(const char *name) |
236 | { | 234 | { |
237 | remove_proc_entry(name, proc_net_rpc); | 235 | struct sunrpc_net *sn; |
236 | |||
237 | sn = net_generic(&init_net, sunrpc_net_id); | ||
238 | remove_proc_entry(name, sn->proc_net_rpc); | ||
238 | } | 239 | } |
239 | EXPORT_SYMBOL_GPL(rpc_proc_unregister); | 240 | EXPORT_SYMBOL_GPL(rpc_proc_unregister); |
240 | 241 | ||
@@ -248,25 +249,29 @@ EXPORT_SYMBOL_GPL(svc_proc_register); | |||
248 | void | 249 | void |
249 | svc_proc_unregister(const char *name) | 250 | svc_proc_unregister(const char *name) |
250 | { | 251 | { |
251 | remove_proc_entry(name, proc_net_rpc); | 252 | struct sunrpc_net *sn; |
253 | |||
254 | sn = net_generic(&init_net, sunrpc_net_id); | ||
255 | remove_proc_entry(name, sn->proc_net_rpc); | ||
252 | } | 256 | } |
253 | EXPORT_SYMBOL_GPL(svc_proc_unregister); | 257 | EXPORT_SYMBOL_GPL(svc_proc_unregister); |
254 | 258 | ||
255 | void | 259 | int rpc_proc_init(struct net *net) |
256 | rpc_proc_init(void) | ||
257 | { | 260 | { |
261 | struct sunrpc_net *sn; | ||
262 | |||
258 | dprintk("RPC: registering /proc/net/rpc\n"); | 263 | dprintk("RPC: registering /proc/net/rpc\n"); |
259 | if (!proc_net_rpc) | 264 | sn = net_generic(net, sunrpc_net_id); |
260 | proc_net_rpc = proc_mkdir("rpc", init_net.proc_net); | 265 | sn->proc_net_rpc = proc_mkdir("rpc", net->proc_net); |
266 | if (sn->proc_net_rpc == NULL) | ||
267 | return -ENOMEM; | ||
268 | |||
269 | return 0; | ||
261 | } | 270 | } |
262 | 271 | ||
263 | void | 272 | void rpc_proc_exit(struct net *net) |
264 | rpc_proc_exit(void) | ||
265 | { | 273 | { |
266 | dprintk("RPC: unregistering /proc/net/rpc\n"); | 274 | dprintk("RPC: unregistering /proc/net/rpc\n"); |
267 | if (proc_net_rpc) { | 275 | remove_proc_entry("rpc", net->proc_net); |
268 | proc_net_rpc = NULL; | ||
269 | remove_proc_entry("rpc", init_net.proc_net); | ||
270 | } | ||
271 | } | 276 | } |
272 | 277 | ||