diff options
| author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2011-10-25 07:17:08 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-10-25 07:18:42 -0400 |
| commit | e40f5e29ef0909ecba1d759cc930efb7a9a7d935 (patch) | |
| tree | 204316f20d01c6e0fadd172f9752798b9f60a779 | |
| parent | d99085605cd245d8f24858e9d0b06013e13aa044 (diff) | |
SUNRPC: setup rpcbind clients if service requires it
New function ("svc_uses_rpcbind") will be used to detect, that new service will
send portmapper register calls. For such services we will create rpcbind
clients and remove all stale portmap registrations.
Also, svc_rpcb_cleanup() will be set as sv_shutdown callback for such services
in case of this field wasn't initialized earlier. This will allow to destroy
rpcbind clients when no other users of them left.
Note: Currently, any creating service will be detected as portmap user.
Probably, this is wrong. But now it depends on program versions "vs_hidden"
flag.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| -rw-r--r-- | net/sunrpc/svc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index d2d61bfa3306..918edc310fd1 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
| @@ -454,8 +454,15 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, | |||
| 454 | spin_lock_init(&pool->sp_lock); | 454 | spin_lock_init(&pool->sp_lock); |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | /* Remove any stale portmap registrations */ | 457 | if (svc_uses_rpcbind(serv)) { |
| 458 | svc_unregister(serv); | 458 | if (svc_rpcb_setup(serv) < 0) { |
| 459 | kfree(serv->sv_pools); | ||
| 460 | kfree(serv); | ||
| 461 | return NULL; | ||
| 462 | } | ||
| 463 | if (!serv->sv_shutdown) | ||
| 464 | serv->sv_shutdown = svc_rpcb_cleanup; | ||
| 465 | } | ||
| 459 | 466 | ||
| 460 | return serv; | 467 | return serv; |
| 461 | } | 468 | } |
