diff mbox

[04/11] lockd: Add nlm_destroy_host_locked()

Message ID 20101209164847.4513.15855.stgit@matisse.1015granger.net (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Chuck Lever III Dec. 9, 2010, 4:48 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index ed1895a..52e21c3 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -227,16 +227,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);
 
@@ -244,6 +249,8 @@  nlm_destroy_host(struct nlm_host *host)
 	if (clnt != NULL)
 		rpc_shutdown_client(clnt);
 	kfree(host);
+
+	nrhosts--;
 }
 
 /**
@@ -585,11 +592,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;