diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2011-10-25 07:16:58 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-10-25 07:18:05 -0400 |
commit | d99085605cd245d8f24858e9d0b06013e13aa044 (patch) | |
tree | 267911a05e429edd0a5628228d42721bace2ebfd /net/sunrpc | |
parent | 253fb070e78db981740b000914b04b9203092925 (diff) |
SUNRPC: introduce svc helpers for prepairing rpcbind infrastructure
This helpers will be used only for those services, that will send portmapper
registration calls.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 2 | ||||
-rw-r--r-- | net/sunrpc/svc.c | 35 |
2 files changed, 36 insertions, 1 deletions
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index f5309aba1a14..c24626537a7d 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -320,7 +320,7 @@ out: | |||
320 | * Returns zero on success, otherwise a negative errno value | 320 | * Returns zero on success, otherwise a negative errno value |
321 | * is returned. | 321 | * is returned. |
322 | */ | 322 | */ |
323 | static int rpcb_create_local(void) | 323 | int rpcb_create_local(void) |
324 | { | 324 | { |
325 | static DEFINE_MUTEX(rpcb_create_local_mutex); | 325 | static DEFINE_MUTEX(rpcb_create_local_mutex); |
326 | int result = 0; | 326 | int result = 0; |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 6a69a1131fb7..d2d61bfa3306 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -354,6 +354,41 @@ svc_pool_for_cpu(struct svc_serv *serv, int cpu) | |||
354 | return &serv->sv_pools[pidx % serv->sv_nrpools]; | 354 | return &serv->sv_pools[pidx % serv->sv_nrpools]; |
355 | } | 355 | } |
356 | 356 | ||
357 | static int svc_rpcb_setup(struct svc_serv *serv) | ||
358 | { | ||
359 | int err; | ||
360 | |||
361 | err = rpcb_create_local(); | ||
362 | if (err) | ||
363 | return err; | ||
364 | |||
365 | /* Remove any stale portmap registrations */ | ||
366 | svc_unregister(serv); | ||
367 | return 0; | ||
368 | } | ||
369 | |||
370 | static void svc_rpcb_cleanup(struct svc_serv *serv) | ||
371 | { | ||
372 | svc_unregister(serv); | ||
373 | rpcb_put_local(); | ||
374 | } | ||
375 | |||
376 | static int svc_uses_rpcbind(struct svc_serv *serv) | ||
377 | { | ||
378 | struct svc_program *progp; | ||
379 | unsigned int i; | ||
380 | |||
381 | for (progp = serv->sv_program; progp; progp = progp->pg_next) { | ||
382 | for (i = 0; i < progp->pg_nvers; i++) { | ||
383 | if (progp->pg_vers[i] == NULL) | ||
384 | continue; | ||
385 | if (progp->pg_vers[i]->vs_hidden == 0) | ||
386 | return 1; | ||
387 | } | ||
388 | } | ||
389 | |||
390 | return 0; | ||
391 | } | ||
357 | 392 | ||
358 | /* | 393 | /* |
359 | * Create an RPC service | 394 | * Create an RPC service |