Commit 3b64739fb928c34b13db6b5adcb0d3efb19e78be
Committed by
Trond Myklebust
1 parent
0e1cb5c0aa
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 3 changed files with 23 additions and 8 deletions Side-by-side Diff
fs/lockd/host.c
... | ... | @@ -565,12 +565,8 @@ |
565 | 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 | 568 | void |
573 | -nlm_shutdown_hosts(void) | |
569 | +nlm_shutdown_hosts_net(struct net *net) | |
574 | 570 | { |
575 | 571 | struct hlist_head *chain; |
576 | 572 | struct hlist_node *pos; |
... | ... | @@ -582,6 +578,8 @@ |
582 | 578 | /* First, make all hosts eligible for gc */ |
583 | 579 | dprintk("lockd: nuking all hosts...\n"); |
584 | 580 | for_each_host(host, pos, chain, nlm_server_hosts) { |
581 | + if (net && host->net != net) | |
582 | + continue; | |
585 | 583 | host->h_expires = jiffies - 1; |
586 | 584 | if (host->h_rpcclnt) { |
587 | 585 | rpc_shutdown_client(host->h_rpcclnt); |
588 | 586 | |
589 | 587 | |
590 | 588 | |
... | ... | @@ -592,15 +590,29 @@ |
592 | 590 | /* Then, perform a garbage collection pass */ |
593 | 591 | nlm_gc_hosts(); |
594 | 592 | mutex_unlock(&nlm_host_mutex); |
593 | +} | |
595 | 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); | |
607 | + | |
596 | 608 | /* complain if any hosts are left */ |
597 | 609 | if (nrhosts != 0) { |
598 | 610 | printk(KERN_WARNING "lockd: couldn't shutdown host module!\n"); |
599 | 611 | dprintk("lockd: %lu hosts left:\n", nrhosts); |
600 | 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 | 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 | } |
fs/lockd/svc.c
... | ... | @@ -281,8 +281,10 @@ |
281 | 281 | struct svc_serv *serv = nlmsvc_rqst->rq_server; |
282 | 282 | |
283 | 283 | if (ln->nlmsvc_users) { |
284 | - if (--ln->nlmsvc_users == 0) | |
284 | + if (--ln->nlmsvc_users == 0) { | |
285 | + nlm_shutdown_hosts_net(net); | |
285 | 286 | svc_shutdown_net(serv, net); |
287 | + } | |
286 | 288 | } else { |
287 | 289 | printk(KERN_ERR "lockd_down_net: no users! task=%p, net=%p\n", |
288 | 290 | nlmsvc_task, net); |
include/linux/lockd/lockd.h
... | ... | @@ -234,6 +234,7 @@ |
234 | 234 | void nlm_rebind_host(struct nlm_host *); |
235 | 235 | struct nlm_host * nlm_get_host(struct nlm_host *); |
236 | 236 | void nlm_shutdown_hosts(void); |
237 | +void nlm_shutdown_hosts_net(struct net *net); | |
237 | 238 | void nlm_host_rebooted(const struct nlm_reboot *); |
238 | 239 | |
239 | 240 | /* |