aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd/host.c')
-rw-r--r--fs/lockd/host.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 4449ef0b7837..3b55fe5e94a2 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -164,6 +164,34 @@ out:
164 return host; 164 return host;
165} 165}
166 166
167/*
168 * Destroy a host
169 */
170static void
171nlm_destroy_host(struct nlm_host *host)
172{
173 struct rpc_clnt *clnt;
174
175 BUG_ON(!list_empty(&host->h_lockowners));
176 BUG_ON(atomic_read(&host->h_count));
177
178 /*
179 * Release NSM handle and unmonitor host.
180 */
181 nsm_unmonitor(host);
182
183 if ((clnt = host->h_rpcclnt) != NULL) {
184 if (atomic_read(&clnt->cl_users)) {
185 printk(KERN_WARNING
186 "lockd: active RPC handle\n");
187 clnt->cl_dead = 1;
188 } else {
189 rpc_destroy_client(host->h_rpcclnt);
190 }
191 }
192 kfree(host);
193}
194
167struct nlm_host * 195struct nlm_host *
168nlm_find_client(void) 196nlm_find_client(void)
169{ 197{
@@ -400,7 +428,6 @@ nlm_gc_hosts(void)
400 struct hlist_head *chain; 428 struct hlist_head *chain;
401 struct hlist_node *pos, *next; 429 struct hlist_node *pos, *next;
402 struct nlm_host *host; 430 struct nlm_host *host;
403 struct rpc_clnt *clnt;
404 431
405 dprintk("lockd: host garbage collection\n"); 432 dprintk("lockd: host garbage collection\n");
406 for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) { 433 for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) {
@@ -423,21 +450,7 @@ nlm_gc_hosts(void)
423 dprintk("lockd: delete host %s\n", host->h_name); 450 dprintk("lockd: delete host %s\n", host->h_name);
424 hlist_del_init(&host->h_hash); 451 hlist_del_init(&host->h_hash);
425 452
426 /* 453 nlm_destroy_host(host);
427 * Unmonitor unless host was invalidated (i.e. lockd restarted)
428 */
429 nsm_unmonitor(host);
430
431 if ((clnt = host->h_rpcclnt) != NULL) {
432 if (atomic_read(&clnt->cl_users)) {
433 printk(KERN_WARNING
434 "lockd: active RPC handle\n");
435 clnt->cl_dead = 1;
436 } else {
437 rpc_destroy_client(host->h_rpcclnt);
438 }
439 }
440 kfree(host);
441 nrhosts--; 454 nrhosts--;
442 } 455 }
443 } 456 }