diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-07-25 08:56:03 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-07-27 16:48:43 -0400 |
commit | 27adaddc8de7f523a172246d5104cf1cd5e2191b (patch) | |
tree | 50a6daec2fb96b81db53371a945e054039c7099e /fs/lockd | |
parent | b26411f85d3763ec5fc553854d9c3c0966072090 (diff) |
LockD: make garbage collector network namespace aware.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/host.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 2c5f41b098e9..991274a55664 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -45,7 +45,7 @@ static unsigned long next_gc; | |||
45 | static unsigned long nrhosts; | 45 | static unsigned long nrhosts; |
46 | static DEFINE_MUTEX(nlm_host_mutex); | 46 | static DEFINE_MUTEX(nlm_host_mutex); |
47 | 47 | ||
48 | static void nlm_gc_hosts(void); | 48 | static void nlm_gc_hosts(struct net *net); |
49 | 49 | ||
50 | struct nlm_lookup_host_info { | 50 | struct nlm_lookup_host_info { |
51 | const int server; /* search for server|client */ | 51 | const int server; /* search for server|client */ |
@@ -345,7 +345,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | |||
345 | mutex_lock(&nlm_host_mutex); | 345 | mutex_lock(&nlm_host_mutex); |
346 | 346 | ||
347 | if (time_after_eq(jiffies, next_gc)) | 347 | if (time_after_eq(jiffies, next_gc)) |
348 | nlm_gc_hosts(); | 348 | nlm_gc_hosts(net); |
349 | 349 | ||
350 | chain = &nlm_server_hosts[nlm_hash_address(ni.sap)]; | 350 | chain = &nlm_server_hosts[nlm_hash_address(ni.sap)]; |
351 | hlist_for_each_entry(host, pos, chain, h_hash) { | 351 | hlist_for_each_entry(host, pos, chain, h_hash) { |
@@ -588,7 +588,7 @@ nlm_shutdown_hosts_net(struct net *net) | |||
588 | } | 588 | } |
589 | 589 | ||
590 | /* Then, perform a garbage collection pass */ | 590 | /* Then, perform a garbage collection pass */ |
591 | nlm_gc_hosts(); | 591 | nlm_gc_hosts(net); |
592 | mutex_unlock(&nlm_host_mutex); | 592 | mutex_unlock(&nlm_host_mutex); |
593 | } | 593 | } |
594 | 594 | ||
@@ -623,27 +623,31 @@ nlm_shutdown_hosts(void) | |||
623 | * mark & sweep for resources held by remote clients. | 623 | * mark & sweep for resources held by remote clients. |
624 | */ | 624 | */ |
625 | static void | 625 | static void |
626 | nlm_gc_hosts(void) | 626 | nlm_gc_hosts(struct net *net) |
627 | { | 627 | { |
628 | struct hlist_head *chain; | 628 | struct hlist_head *chain; |
629 | struct hlist_node *pos, *next; | 629 | struct hlist_node *pos, *next; |
630 | struct nlm_host *host; | 630 | struct nlm_host *host; |
631 | struct net *net = &init_net; | ||
632 | 631 | ||
633 | dprintk("lockd: host garbage collection\n"); | 632 | dprintk("lockd: host garbage collection for net %p\n", net); |
634 | for_each_host(host, pos, chain, nlm_server_hosts) | 633 | for_each_host(host, pos, chain, nlm_server_hosts) { |
634 | if (net && host->net != net) | ||
635 | continue; | ||
635 | host->h_inuse = 0; | 636 | host->h_inuse = 0; |
637 | } | ||
636 | 638 | ||
637 | /* Mark all hosts that hold locks, blocks or shares */ | 639 | /* Mark all hosts that hold locks, blocks or shares */ |
638 | nlmsvc_mark_resources(net); | 640 | nlmsvc_mark_resources(net); |
639 | 641 | ||
640 | for_each_host_safe(host, pos, next, chain, nlm_server_hosts) { | 642 | for_each_host_safe(host, pos, next, chain, nlm_server_hosts) { |
643 | if (net && host->net != net) | ||
644 | continue; | ||
641 | if (atomic_read(&host->h_count) || host->h_inuse | 645 | if (atomic_read(&host->h_count) || host->h_inuse |
642 | || time_before(jiffies, host->h_expires)) { | 646 | || time_before(jiffies, host->h_expires)) { |
643 | dprintk("nlm_gc_hosts skipping %s " | 647 | dprintk("nlm_gc_hosts skipping %s " |
644 | "(cnt %d use %d exp %ld)\n", | 648 | "(cnt %d use %d exp %ld net %p)\n", |
645 | host->h_name, atomic_read(&host->h_count), | 649 | host->h_name, atomic_read(&host->h_count), |
646 | host->h_inuse, host->h_expires); | 650 | host->h_inuse, host->h_expires, host->net); |
647 | continue; | 651 | continue; |
648 | } | 652 | } |
649 | nlm_destroy_host_locked(host); | 653 | nlm_destroy_host_locked(host); |