diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-05-04 04:49:41 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-05-31 20:29:40 -0400 |
commit | 786185b5f8abefa6a8a16695bb4a59c164d5a071 (patch) | |
tree | 780eafd98f98a093fda540898595b47b4261764c /fs/nfsd/nfssvc.c | |
parent | 9793f7c88937e7ac07305ab1af1a519225836823 (diff) |
SUNRPC: move per-net operations from svc_destroy()
The idea is to separate service destruction and per-net operations,
because these are two different things and the mix looks ugly.
Notes:
1) For NFS server this patch looks ugly (sorry for that). But these
place will be rewritten soon during NFSd containerization.
2) LockD per-net counter increase int lockd_up() was moved prior to
make_socks() to make lockd_down_net() call safe in case of error.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfssvc.c')
-rw-r--r-- | fs/nfsd/nfssvc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 0762f3c9e0fb..ee709fc8f58b 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -382,6 +382,7 @@ int nfsd_set_nrthreads(int n, int *nthreads) | |||
382 | int i = 0; | 382 | int i = 0; |
383 | int tot = 0; | 383 | int tot = 0; |
384 | int err = 0; | 384 | int err = 0; |
385 | struct net *net = &init_net; | ||
385 | 386 | ||
386 | WARN_ON(!mutex_is_locked(&nfsd_mutex)); | 387 | WARN_ON(!mutex_is_locked(&nfsd_mutex)); |
387 | 388 | ||
@@ -426,6 +427,9 @@ int nfsd_set_nrthreads(int n, int *nthreads) | |||
426 | if (err) | 427 | if (err) |
427 | break; | 428 | break; |
428 | } | 429 | } |
430 | |||
431 | if (nfsd_serv->sv_nrthreads == 1) | ||
432 | svc_shutdown_net(nfsd_serv, net); | ||
429 | svc_destroy(nfsd_serv); | 433 | svc_destroy(nfsd_serv); |
430 | 434 | ||
431 | return err; | 435 | return err; |
@@ -441,6 +445,7 @@ nfsd_svc(unsigned short port, int nrservs) | |||
441 | { | 445 | { |
442 | int error; | 446 | int error; |
443 | bool nfsd_up_before; | 447 | bool nfsd_up_before; |
448 | struct net *net = &init_net; | ||
444 | 449 | ||
445 | mutex_lock(&nfsd_mutex); | 450 | mutex_lock(&nfsd_mutex); |
446 | dprintk("nfsd: creating service\n"); | 451 | dprintk("nfsd: creating service\n"); |
@@ -473,6 +478,8 @@ out_shutdown: | |||
473 | if (error < 0 && !nfsd_up_before) | 478 | if (error < 0 && !nfsd_up_before) |
474 | nfsd_shutdown(); | 479 | nfsd_shutdown(); |
475 | out_destroy: | 480 | out_destroy: |
481 | if (nfsd_serv->sv_nrthreads == 1) | ||
482 | svc_shutdown_net(nfsd_serv, net); | ||
476 | svc_destroy(nfsd_serv); /* Release server */ | 483 | svc_destroy(nfsd_serv); /* Release server */ |
477 | out: | 484 | out: |
478 | mutex_unlock(&nfsd_mutex); | 485 | mutex_unlock(&nfsd_mutex); |
@@ -556,6 +563,9 @@ nfsd(void *vrqstp) | |||
556 | nfsdstats.th_cnt --; | 563 | nfsdstats.th_cnt --; |
557 | 564 | ||
558 | out: | 565 | out: |
566 | if (rqstp->rq_server->sv_nrthreads == 1) | ||
567 | svc_shutdown_net(rqstp->rq_server, &init_net); | ||
568 | |||
559 | /* Release the thread */ | 569 | /* Release the thread */ |
560 | svc_exit_thread(rqstp); | 570 | svc_exit_thread(rqstp); |
561 | 571 | ||
@@ -668,8 +678,12 @@ int nfsd_pool_stats_open(struct inode *inode, struct file *file) | |||
668 | int nfsd_pool_stats_release(struct inode *inode, struct file *file) | 678 | int nfsd_pool_stats_release(struct inode *inode, struct file *file) |
669 | { | 679 | { |
670 | int ret = seq_release(inode, file); | 680 | int ret = seq_release(inode, file); |
681 | struct net *net = &init_net; | ||
682 | |||
671 | mutex_lock(&nfsd_mutex); | 683 | mutex_lock(&nfsd_mutex); |
672 | /* this function really, really should have been called svc_put() */ | 684 | /* this function really, really should have been called svc_put() */ |
685 | if (nfsd_serv->sv_nrthreads == 1) | ||
686 | svc_shutdown_net(nfsd_serv, net); | ||
673 | svc_destroy(nfsd_serv); | 687 | svc_destroy(nfsd_serv); |
674 | mutex_unlock(&nfsd_mutex); | 688 | mutex_unlock(&nfsd_mutex); |
675 | return ret; | 689 | return ret; |