aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-01-31 05:09:25 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-02-15 00:19:46 -0500
commit074d0f67cfe0af4927ce49560f403096b490c47f (patch)
tree89e578ca4f35a1bddb6cc7c8547ed65744d7bb35 /net
parent7b147f1ff267d12e0d189ca3d4156ed5a76b8d99 (diff)
SUNRPC: service shutdown function in network namespace context introduced
This function is enough for releasing resources, allocated for network namespace context, in case of sharing service between them. IOW, each service "user" (LockD, NFSd, etc), which wants to share service between network namespaces, have to release related resources by the function, introduced in this patch, instead of performing service shutdown (of course in case the service is shared already to the moment of release). Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/svc.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 6cc0ea3d26f1..78abac48985b 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -510,6 +510,24 @@ svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
510} 510}
511EXPORT_SYMBOL_GPL(svc_create_pooled); 511EXPORT_SYMBOL_GPL(svc_create_pooled);
512 512
513void svc_shutdown_net(struct svc_serv *serv, struct net *net)
514{
515 /*
516 * The set of xprts (contained in the sv_tempsocks and
517 * sv_permsocks lists) is now constant, since it is modified
518 * only by accepting new sockets (done by service threads in
519 * svc_recv) or aging old ones (done by sv_temptimer), or
520 * configuration changes (excluded by whatever locking the
521 * caller is using--nfsd_mutex in the case of nfsd). So it's
522 * safe to traverse those lists and shut everything down:
523 */
524 svc_close_net(serv, net);
525
526 if (serv->sv_shutdown)
527 serv->sv_shutdown(serv, net);
528}
529EXPORT_SYMBOL_GPL(svc_shutdown_net);
530
513/* 531/*
514 * Destroy an RPC service. Should be called with appropriate locking to 532 * Destroy an RPC service. Should be called with appropriate locking to
515 * protect the sv_nrthreads, sv_permsocks and sv_tempsocks. 533 * protect the sv_nrthreads, sv_permsocks and sv_tempsocks.
@@ -532,16 +550,8 @@ svc_destroy(struct svc_serv *serv)
532 printk("svc_destroy: no threads for serv=%p!\n", serv); 550 printk("svc_destroy: no threads for serv=%p!\n", serv);
533 551
534 del_timer_sync(&serv->sv_temptimer); 552 del_timer_sync(&serv->sv_temptimer);
535 /* 553
536 * The set of xprts (contained in the sv_tempsocks and 554 svc_shutdown_net(serv, net);
537 * sv_permsocks lists) is now constant, since it is modified
538 * only by accepting new sockets (done by service threads in
539 * svc_recv) or aging old ones (done by sv_temptimer), or
540 * configuration changes (excluded by whatever locking the
541 * caller is using--nfsd_mutex in the case of nfsd). So it's
542 * safe to traverse those lists and shut everything down:
543 */
544 svc_close_net(serv, net);
545 555
546 /* 556 /*
547 * The last user is gone and thus all sockets have to be destroyed to 557 * The last user is gone and thus all sockets have to be destroyed to
@@ -550,9 +560,6 @@ svc_destroy(struct svc_serv *serv)
550 BUG_ON(!list_empty(&serv->sv_permsocks)); 560 BUG_ON(!list_empty(&serv->sv_permsocks));
551 BUG_ON(!list_empty(&serv->sv_tempsocks)); 561 BUG_ON(!list_empty(&serv->sv_tempsocks));
552 562
553 if (serv->sv_shutdown)
554 serv->sv_shutdown(serv, net);
555
556 cache_clean_deferred(serv); 563 cache_clean_deferred(serv);
557 564
558 if (svc_serv_is_pooled(serv)) 565 if (svc_serv_is_pooled(serv))