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

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

This patch makes it possible to create NFSd program entry ("/proc/net/rpc/nfsd")
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>

authored by

Stanislav Kinsbursky and committed by
Trond Myklebust
246590f5 cc9f4be5

+11 -10
+3 -2
fs/nfsd/stats.c
··· 25 25 #include <linux/module.h> 26 26 #include <linux/sunrpc/stats.h> 27 27 #include <linux/nfsd/stats.h> 28 + #include <net/net_namespace.h> 28 29 29 30 #include "nfsd.h" 30 31 ··· 95 94 void 96 95 nfsd_stat_init(void) 97 96 { 98 - svc_proc_register(&nfsd_svcstats, &nfsd_proc_fops); 97 + svc_proc_register(&init_net, &nfsd_svcstats, &nfsd_proc_fops); 99 98 } 100 99 101 100 void 102 101 nfsd_stat_shutdown(void) 103 102 { 104 - svc_proc_unregister("nfsd"); 103 + svc_proc_unregister(&init_net, "nfsd"); 105 104 }
+4 -4
include/linux/sunrpc/stats.h
··· 61 61 struct proc_dir_entry * rpc_proc_register(struct net *,struct rpc_stat *); 62 62 void rpc_proc_unregister(struct net *,const char *); 63 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 net *, struct svc_stat *, 65 65 const struct file_operations *); 66 - void svc_proc_unregister(const char *); 66 + void svc_proc_unregister(struct net *, const char *); 67 67 68 68 void svc_seq_show(struct seq_file *, 69 69 const struct svc_stat *); ··· 73 73 static inline void rpc_proc_unregister(struct net *net, const char *p) {} 74 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 net *net, struct svc_stat *s, 77 77 const struct file_operations *f) { return NULL; } 78 - static inline void svc_proc_unregister(const char *p) {} 78 + static inline void svc_proc_unregister(struct net *net, const char *p) {} 79 79 80 80 static inline void svc_seq_show(struct seq_file *seq, 81 81 const struct svc_stat *st) {}
+4 -4
net/sunrpc/stats.c
··· 241 241 EXPORT_SYMBOL_GPL(rpc_proc_unregister); 242 242 243 243 struct proc_dir_entry * 244 - svc_proc_register(struct svc_stat *statp, const struct file_operations *fops) 244 + svc_proc_register(struct net *net, struct svc_stat *statp, const struct file_operations *fops) 245 245 { 246 - return do_register(&init_net, statp->program->pg_name, statp, fops); 246 + return do_register(net, statp->program->pg_name, statp, fops); 247 247 } 248 248 EXPORT_SYMBOL_GPL(svc_proc_register); 249 249 250 250 void 251 - svc_proc_unregister(const char *name) 251 + svc_proc_unregister(struct net *net, const char *name) 252 252 { 253 253 struct sunrpc_net *sn; 254 254 255 - sn = net_generic(&init_net, sunrpc_net_id); 255 + sn = net_generic(net, sunrpc_net_id); 256 256 remove_proc_entry(name, sn->proc_net_rpc); 257 257 } 258 258 EXPORT_SYMBOL_GPL(svc_proc_unregister);