aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/stats.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/stats.c')
-rw-r--r--net/sunrpc/stats.c47
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
29struct 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 */
117struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) 116struct 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}
123EXPORT_SYMBOL_GPL(rpc_alloc_iostats); 120EXPORT_SYMBOL_GPL(rpc_alloc_iostats);
124 121
@@ -218,10 +215,11 @@ EXPORT_SYMBOL_GPL(rpc_print_iostats);
218static inline struct proc_dir_entry * 215static inline struct proc_dir_entry *
219do_register(const char *name, void *data, const struct file_operations *fops) 216do_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
227struct proc_dir_entry * 225struct proc_dir_entry *
@@ -234,7 +232,10 @@ EXPORT_SYMBOL_GPL(rpc_proc_register);
234void 232void
235rpc_proc_unregister(const char *name) 233rpc_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}
239EXPORT_SYMBOL_GPL(rpc_proc_unregister); 240EXPORT_SYMBOL_GPL(rpc_proc_unregister);
240 241
@@ -248,25 +249,29 @@ EXPORT_SYMBOL_GPL(svc_proc_register);
248void 249void
249svc_proc_unregister(const char *name) 250svc_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}
253EXPORT_SYMBOL_GPL(svc_proc_unregister); 257EXPORT_SYMBOL_GPL(svc_proc_unregister);
254 258
255void 259int rpc_proc_init(struct net *net)
256rpc_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
263void 272void rpc_proc_exit(struct net *net)
264rpc_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