diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-01-31 06:08:29 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-02-15 00:19:48 -0500 |
commit | 3b64739fb928c34b13db6b5adcb0d3efb19e78be (patch) | |
tree | d3a0e8293b2da6d816c47939675e00da22c576d9 /fs/lockd | |
parent | 0e1cb5c0aad1c37a4eee6db45f52c0b3869db2cc (diff) |
Lockd: shutdown NLM hosts in network namespace context
Lockd now managed in network namespace context. And this patch introduces
network namespace related NLM hosts shutdown in case of releasing per-net Lockd
resources.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/host.c | 26 | ||||
-rw-r--r-- | fs/lockd/svc.c | 4 |
2 files changed, 22 insertions, 8 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 9ebd91dc42c3..eb75ca7c2d6e 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -565,12 +565,8 @@ void nlm_host_rebooted(const struct nlm_reboot *info) | |||
565 | nsm_release(nsm); | 565 | nsm_release(nsm); |
566 | } | 566 | } |
567 | 567 | ||
568 | /* | ||
569 | * Shut down the hosts module. | ||
570 | * Note that this routine is called only at server shutdown time. | ||
571 | */ | ||
572 | void | 568 | void |
573 | nlm_shutdown_hosts(void) | 569 | nlm_shutdown_hosts_net(struct net *net) |
574 | { | 570 | { |
575 | struct hlist_head *chain; | 571 | struct hlist_head *chain; |
576 | struct hlist_node *pos; | 572 | struct hlist_node *pos; |
@@ -582,6 +578,8 @@ nlm_shutdown_hosts(void) | |||
582 | /* First, make all hosts eligible for gc */ | 578 | /* First, make all hosts eligible for gc */ |
583 | dprintk("lockd: nuking all hosts...\n"); | 579 | dprintk("lockd: nuking all hosts...\n"); |
584 | for_each_host(host, pos, chain, nlm_server_hosts) { | 580 | for_each_host(host, pos, chain, nlm_server_hosts) { |
581 | if (net && host->net != net) | ||
582 | continue; | ||
585 | host->h_expires = jiffies - 1; | 583 | host->h_expires = jiffies - 1; |
586 | if (host->h_rpcclnt) { | 584 | if (host->h_rpcclnt) { |
587 | rpc_shutdown_client(host->h_rpcclnt); | 585 | rpc_shutdown_client(host->h_rpcclnt); |
@@ -592,15 +590,29 @@ nlm_shutdown_hosts(void) | |||
592 | /* Then, perform a garbage collection pass */ | 590 | /* Then, perform a garbage collection pass */ |
593 | nlm_gc_hosts(); | 591 | nlm_gc_hosts(); |
594 | mutex_unlock(&nlm_host_mutex); | 592 | mutex_unlock(&nlm_host_mutex); |
593 | } | ||
594 | |||
595 | /* | ||
596 | * Shut down the hosts module. | ||
597 | * Note that this routine is called only at server shutdown time. | ||
598 | */ | ||
599 | void | ||
600 | nlm_shutdown_hosts(void) | ||
601 | { | ||
602 | struct hlist_head *chain; | ||
603 | struct hlist_node *pos; | ||
604 | struct nlm_host *host; | ||
605 | |||
606 | nlm_shutdown_hosts_net(NULL); | ||
595 | 607 | ||
596 | /* complain if any hosts are left */ | 608 | /* complain if any hosts are left */ |
597 | if (nrhosts != 0) { | 609 | if (nrhosts != 0) { |
598 | printk(KERN_WARNING "lockd: couldn't shutdown host module!\n"); | 610 | printk(KERN_WARNING "lockd: couldn't shutdown host module!\n"); |
599 | dprintk("lockd: %lu hosts left:\n", nrhosts); | 611 | dprintk("lockd: %lu hosts left:\n", nrhosts); |
600 | for_each_host(host, pos, chain, nlm_server_hosts) { | 612 | for_each_host(host, pos, chain, nlm_server_hosts) { |
601 | dprintk(" %s (cnt %d use %d exp %ld)\n", | 613 | dprintk(" %s (cnt %d use %d exp %ld net %p)\n", |
602 | host->h_name, atomic_read(&host->h_count), | 614 | host->h_name, atomic_read(&host->h_count), |
603 | host->h_inuse, host->h_expires); | 615 | host->h_inuse, host->h_expires, host->net); |
604 | } | 616 | } |
605 | } | 617 | } |
606 | } | 618 | } |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 90dec426bfd8..2774e1013b34 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -281,8 +281,10 @@ static void lockd_down_net(struct net *net) | |||
281 | struct svc_serv *serv = nlmsvc_rqst->rq_server; | 281 | struct svc_serv *serv = nlmsvc_rqst->rq_server; |
282 | 282 | ||
283 | if (ln->nlmsvc_users) { | 283 | if (ln->nlmsvc_users) { |
284 | if (--ln->nlmsvc_users == 0) | 284 | if (--ln->nlmsvc_users == 0) { |
285 | nlm_shutdown_hosts_net(net); | ||
285 | svc_shutdown_net(serv, net); | 286 | svc_shutdown_net(serv, net); |
287 | } | ||
286 | } else { | 288 | } else { |
287 | printk(KERN_ERR "lockd_down_net: no users! task=%p, net=%p\n", | 289 | printk(KERN_ERR "lockd_down_net: no users! task=%p, net=%p\n", |
288 | nlmsvc_task, net); | 290 | nlmsvc_task, net); |