diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-01-13 05:02:56 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-01-31 19:28:14 -0500 |
commit | bee42f688c915b510a4aabae4f7a99457137d6f3 (patch) | |
tree | a3de1330fcdbd3885fdfa48c5701372d5fef6324 | |
parent | 5247fab5c82779174d50590e0200bf532248a8a1 (diff) |
SUNRPC: register service on creation in current network namespace
Service, using rpcbind (Lockd, NFSd) are starting from userspace call and thus
we can use current network namespace.
There could be a problem with NFSd service, because it's creation can be called
through NFSd fs from different network namespace. But this is a part of "NFSd
per net ns" task and will be fixed in future.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | net/sunrpc/svc.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index a2d3330b70de..cb2caaee2af9 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/kthread.h> | 21 | #include <linux/kthread.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/nsproxy.h> | ||
23 | 24 | ||
24 | #include <linux/sunrpc/types.h> | 25 | #include <linux/sunrpc/types.h> |
25 | #include <linux/sunrpc/xdr.h> | 26 | #include <linux/sunrpc/xdr.h> |
@@ -368,16 +369,16 @@ svc_pool_for_cpu(struct svc_serv *serv, int cpu) | |||
368 | return &serv->sv_pools[pidx % serv->sv_nrpools]; | 369 | return &serv->sv_pools[pidx % serv->sv_nrpools]; |
369 | } | 370 | } |
370 | 371 | ||
371 | static int svc_rpcb_setup(struct svc_serv *serv) | 372 | static int svc_rpcb_setup(struct svc_serv *serv, struct net *net) |
372 | { | 373 | { |
373 | int err; | 374 | int err; |
374 | 375 | ||
375 | err = rpcb_create_local(&init_net); | 376 | err = rpcb_create_local(net); |
376 | if (err) | 377 | if (err) |
377 | return err; | 378 | return err; |
378 | 379 | ||
379 | /* Remove any stale portmap registrations */ | 380 | /* Remove any stale portmap registrations */ |
380 | svc_unregister(serv, &init_net); | 381 | svc_unregister(serv, net); |
381 | return 0; | 382 | return 0; |
382 | } | 383 | } |
383 | 384 | ||
@@ -470,7 +471,7 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, | |||
470 | } | 471 | } |
471 | 472 | ||
472 | if (svc_uses_rpcbind(serv)) { | 473 | if (svc_uses_rpcbind(serv)) { |
473 | if (svc_rpcb_setup(serv) < 0) { | 474 | if (svc_rpcb_setup(serv, current->nsproxy->net_ns) < 0) { |
474 | kfree(serv->sv_pools); | 475 | kfree(serv->sv_pools); |
475 | kfree(serv); | 476 | kfree(serv); |
476 | return NULL; | 477 | return NULL; |