[PATCH 08/12] lockd: move debugging warning into a separate function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will also save some duplicated code after splitting apart client
and server.

Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxxxxxx>
---
 fs/lockd/host.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index bb3bf36..3fd7573 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -553,6 +553,21 @@ void nlm_host_rebooted(const struct sockaddr_in *sin,
 	}
 }
 
+static void warn_host_leak(struct host_table *table)
+{
+	struct hlist_head *chain;
+	struct hlist_node *pos;
+	struct nlm_host	*host;
+
+	printk(KERN_WARNING "lockd: couldn't shutdown host module!\n");
+	dprintk("lockd: %d hosts left:\n", table->ht_num);
+	for_each_host(host, pos, chain, table) {
+		dprintk("       %s (cnt %d use %d exp %ld)\n",
+			host->h_name, atomic_read(&host->h_count),
+			host->h_inuse, host->h_expires);
+	}
+}
+
 /*
  * Shut down the hosts module.
  * Note that this routine is called only at server shutdown time.
@@ -582,15 +597,8 @@ nlm_shutdown_hosts(void)
 	mutex_unlock(&nlm_hosts.ht_mutex);
 
 	/* complain if any hosts are left */
-	if (nlm_hosts.ht_num) {
-		printk(KERN_WARNING "lockd: couldn't shutdown host module!\n");
-		dprintk("lockd: %d hosts left:\n", nlm_hosts.ht_num);
-		for_each_host(host, pos, chain, &nlm_hosts) {
-			dprintk("       %s (cnt %d use %d exp %ld)\n",
-				host->h_name, atomic_read(&host->h_count),
-				host->h_inuse, host->h_expires);
-		}
-	}
+	if (nlm_hosts.ht_num)
+		warn_host_leak(&nlm_hosts);
 }
 
 /*
-- 
1.5.5.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux