diff options
Diffstat (limited to 'net/sunrpc/svc.c')
-rw-r--r-- | net/sunrpc/svc.c | 33 |
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 | } |
511 | EXPORT_SYMBOL_GPL(svc_create_pooled); | 511 | EXPORT_SYMBOL_GPL(svc_create_pooled); |
512 | 512 | ||
513 | void 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 | } | ||
529 | EXPORT_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)) |