diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-05-02 08:08:38 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-05-31 20:29:39 -0400 |
commit | 9793f7c88937e7ac07305ab1af1a519225836823 (patch) | |
tree | 48a4283a15cb0d5a427e722075fe546cc8cdcc53 /net/sunrpc/svc.c | |
parent | c52226daf553b21891f39777d78a54ea4e7e8654 (diff) |
SUNRPC: new svc_bind() routine introduced
This new routine is responsible for service registration in a specified
network context.
The idea is to separate service creation from per-net operations.
Note also: since registering service with svc_bind() can fail, the
service will be destroyed and during destruction it will try to
unregister itself from rpcbind. In this case unregistration has to be
skipped.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/svc.c')
-rw-r--r-- | net/sunrpc/svc.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 4153846984ac..e6d542cee0f3 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -407,6 +407,14 @@ static int svc_uses_rpcbind(struct svc_serv *serv) | |||
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | 409 | ||
410 | int svc_bind(struct svc_serv *serv, struct net *net) | ||
411 | { | ||
412 | if (!svc_uses_rpcbind(serv)) | ||
413 | return 0; | ||
414 | return svc_rpcb_setup(serv, net); | ||
415 | } | ||
416 | EXPORT_SYMBOL_GPL(svc_bind); | ||
417 | |||
410 | /* | 418 | /* |
411 | * Create an RPC service | 419 | * Create an RPC service |
412 | */ | 420 | */ |
@@ -471,15 +479,8 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, | |||
471 | spin_lock_init(&pool->sp_lock); | 479 | spin_lock_init(&pool->sp_lock); |
472 | } | 480 | } |
473 | 481 | ||
474 | if (svc_uses_rpcbind(serv)) { | 482 | if (svc_uses_rpcbind(serv) && (!serv->sv_shutdown)) |
475 | if (svc_rpcb_setup(serv, current->nsproxy->net_ns) < 0) { | 483 | serv->sv_shutdown = svc_rpcb_cleanup; |
476 | kfree(serv->sv_pools); | ||
477 | kfree(serv); | ||
478 | return NULL; | ||
479 | } | ||
480 | if (!serv->sv_shutdown) | ||
481 | serv->sv_shutdown = svc_rpcb_cleanup; | ||
482 | } | ||
483 | 484 | ||
484 | return serv; | 485 | return serv; |
485 | } | 486 | } |