All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 04/11] lockd: Add nlm_destroy_host_locked()
Date: Tue, 14 Dec 2010 10:05:33 -0500	[thread overview]
Message-ID: <20101214150533.2736.74362.stgit@matisse.1015granger.net> (raw)
In-Reply-To: <20101214150036.2736.98254.stgit@matisse.1015granger.net>

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>
---

 fs/lockd/host.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 1911f34..e58e142 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;


  parent reply	other threads:[~2010-12-14 15:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 15:04 [PATCH 00/11] nlm_host cache split for 2.6.38 Chuck Lever
2010-12-14 15:05 ` [PATCH 01/11] lockd: define host_for_each{_safe} macros Chuck Lever
2010-12-14 15:05 ` [PATCH 02/11] lockd: reorganize nlm_host_rebooted Chuck Lever
2010-12-14 15:05 ` [PATCH 03/11] lockd: Add nlm_alloc_host() Chuck Lever
2010-12-14 15:05 ` Chuck Lever [this message]
2010-12-14 15:05 ` [PATCH 05/11] lockd: Split nlm_release_call() Chuck Lever
2010-12-14 15:05 ` [PATCH 06/11] lockd: Create client-side nlm_host cache Chuck Lever
2010-12-14 15:06 ` [PATCH 07/11] lockd: Clean up nlmsvc_lookup_host() Chuck Lever
2010-12-14 15:06 ` [PATCH 08/11] lockd: Rename nlm_hosts Chuck Lever
2010-12-14 15:06 ` [PATCH 09/11] lockd: Make nrhosts an unsigned long Chuck Lever
2010-12-14 15:06 ` [PATCH 10/11] lockd: Remove nlm_lookup_host() Chuck Lever
2010-12-14 15:06 ` [PATCH 11/11] lockd: Remove src_sap and src_len from nlm_lookup_host_info struct Chuck Lever
  -- strict thread matches above, loose matches on Subject: below --
2010-12-09 16:48 [PATCH 00/11] RFC: Split nlm_host cache Chuck Lever
2010-12-09 16:48 ` [PATCH 04/11] lockd: Add nlm_destroy_host_locked() Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101214150533.2736.74362.stgit@matisse.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@netapp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.