aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-12-14 10:05:33 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-12-16 12:37:26 -0500
commit723bb5b5052faba57060a2feb564ced22416b5bc (patch)
treee70324287a277846d32ddc3a6724251e1fc27724 /fs
parenta7952f4056d4d9c63c70534bcfd4f2c11e487000 (diff)
lockd: Add nlm_destroy_host_locked()
Refactor the tail of nlm_gc_hosts() into nlm_destroy_host() so that this logic can be used separately from garbage collection. Rename it _locked() to document that it must be called with the hosts cache mutex held. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/lockd/host.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 1911f34be976..e58e1426d161 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -231,16 +231,21 @@ out:
231} 231}
232 232
233/* 233/*
234 * Destroy a host 234 * Destroy an nlm_host and free associated resources
235 *
236 * Caller must hold nlm_host_mutex.
235 */ 237 */
236static void 238static void nlm_destroy_host_locked(struct nlm_host *host)
237nlm_destroy_host(struct nlm_host *host)
238{ 239{
239 struct rpc_clnt *clnt; 240 struct rpc_clnt *clnt;
240 241
242 dprintk("lockd: destroy host %s\n", host->h_name);
243
241 BUG_ON(!list_empty(&host->h_lockowners)); 244 BUG_ON(!list_empty(&host->h_lockowners));
242 BUG_ON(atomic_read(&host->h_count)); 245 BUG_ON(atomic_read(&host->h_count));
243 246
247 hlist_del_init(&host->h_hash);
248
244 nsm_unmonitor(host); 249 nsm_unmonitor(host);
245 nsm_release(host->h_nsmhandle); 250 nsm_release(host->h_nsmhandle);
246 251
@@ -248,6 +253,8 @@ nlm_destroy_host(struct nlm_host *host)
248 if (clnt != NULL) 253 if (clnt != NULL)
249 rpc_shutdown_client(clnt); 254 rpc_shutdown_client(clnt);
250 kfree(host); 255 kfree(host);
256
257 nrhosts--;
251} 258}
252 259
253/** 260/**
@@ -589,11 +596,7 @@ nlm_gc_hosts(void)
589 host->h_inuse, host->h_expires); 596 host->h_inuse, host->h_expires);
590 continue; 597 continue;
591 } 598 }
592 dprintk("lockd: delete host %s\n", host->h_name); 599 nlm_destroy_host_locked(host);
593 hlist_del_init(&host->h_hash);
594
595 nlm_destroy_host(host);
596 nrhosts--;
597 } 600 }
598 601
599 next_gc = jiffies + NLM_HOST_COLLECT; 602 next_gc = jiffies + NLM_HOST_COLLECT;