aboutsummaryrefslogtreecommitdiff
path: root/fs/lockd/host.c
diff options
context:
space:
mode:
authorChuck Lever2010-12-14 15:05:33 +0000
committerTrond Myklebust2010-12-16 12:37:26 -0500
commit723bb5b5052faba57060a2feb564ced22416b5bc (patch)
treee70324287a277846d32ddc3a6724251e1fc27724 /fs/lockd/host.c
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/lockd/host.c')
-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:
}
/*
- * Destroy a host
+ * Destroy an nlm_host and free associated resources
+ *
+ * Caller must hold nlm_host_mutex.
*/
-static void
-nlm_destroy_host(struct nlm_host *host)
+static void nlm_destroy_host_locked(struct nlm_host *host)
{
struct rpc_clnt *clnt;
+ dprintk("lockd: destroy host %s\n", host->h_name);
+
BUG_ON(!list_empty(&host->h_lockowners));
BUG_ON(atomic_read(&host->h_count));
+ hlist_del_init(&host->h_hash);
+
nsm_unmonitor(host);
nsm_release(host->h_nsmhandle);
@@ -248,6 +253,8 @@ nlm_destroy_host(struct nlm_host *host)
if (clnt != NULL)
rpc_shutdown_client(clnt);
kfree(host);
+
+ nrhosts--;
}
/**
@@ -589,11 +596,7 @@ nlm_gc_hosts(void)
host->h_inuse, host->h_expires);
continue;
}
- dprintk("lockd: delete host %s\n", host->h_name);
- hlist_del_init(&host->h_hash);
-
- nlm_destroy_host(host);
- nrhosts--;
+ nlm_destroy_host_locked(host);
}
next_gc = jiffies + NLM_HOST_COLLECT;