aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/lockd/host.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 7d6ab72bbe65..d35cd6be0675 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -388,6 +388,8 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
388 ln->nrhosts++; 388 ln->nrhosts++;
389 nrhosts++; 389 nrhosts++;
390 390
391 refcount_inc(&host->h_count);
392
391 dprintk("lockd: %s created host %s (%s)\n", 393 dprintk("lockd: %s created host %s (%s)\n",
392 __func__, host->h_name, host->h_addrbuf); 394 __func__, host->h_name, host->h_addrbuf);
393 395
@@ -662,8 +664,7 @@ nlm_gc_hosts(struct net *net)
662 for_each_host_safe(host, next, chain, nlm_server_hosts) { 664 for_each_host_safe(host, next, chain, nlm_server_hosts) {
663 if (net && host->net != net) 665 if (net && host->net != net)
664 continue; 666 continue;
665 if (refcount_read(&host->h_count) || host->h_inuse 667 if (host->h_inuse || time_before(jiffies, host->h_expires)) {
666 || time_before(jiffies, host->h_expires)) {
667 dprintk("nlm_gc_hosts skipping %s " 668 dprintk("nlm_gc_hosts skipping %s "
668 "(cnt %d use %d exp %ld net %x)\n", 669 "(cnt %d use %d exp %ld net %x)\n",
669 host->h_name, refcount_read(&host->h_count), 670 host->h_name, refcount_read(&host->h_count),
@@ -671,7 +672,8 @@ nlm_gc_hosts(struct net *net)
671 host->net->ns.inum); 672 host->net->ns.inum);
672 continue; 673 continue;
673 } 674 }
674 nlm_destroy_host_locked(host); 675 if (refcount_dec_if_one(&host->h_count))
676 nlm_destroy_host_locked(host);
675 } 677 }
676 678
677 if (net) { 679 if (net) {