linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Kinsbursky <skinsbursky@parallels.com>
To: bfields@fieldses.org, Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	devel@openvz.org
Subject: [PATCH RFC 02/13] LockD: make garbage collector network namespace aware.
Date: Sat, 05 May 2012 21:21:47 +0400	[thread overview]
Message-ID: <20120505172146.11559.77305.stgit@localhost.localdomain> (raw)
In-Reply-To: <20120505170722.11559.74503.stgit@localhost.localdomain>

Refresh of diff-lockd-make-hosts-garbage-collect-check-per-net
---
 fs/lockd/host.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 2c5f41b..991274a 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -45,7 +45,7 @@ static unsigned long		next_gc;
 static unsigned long		nrhosts;
 static DEFINE_MUTEX(nlm_host_mutex);
 
-static void			nlm_gc_hosts(void);
+static void			nlm_gc_hosts(struct net *net);
 
 struct nlm_lookup_host_info {
 	const int		server;		/* search for server|client */
@@ -345,7 +345,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
 	mutex_lock(&nlm_host_mutex);
 
 	if (time_after_eq(jiffies, next_gc))
-		nlm_gc_hosts();
+		nlm_gc_hosts(net);
 
 	chain = &nlm_server_hosts[nlm_hash_address(ni.sap)];
 	hlist_for_each_entry(host, pos, chain, h_hash) {
@@ -588,7 +588,7 @@ nlm_shutdown_hosts_net(struct net *net)
 	}
 
 	/* Then, perform a garbage collection pass */
-	nlm_gc_hosts();
+	nlm_gc_hosts(net);
 	mutex_unlock(&nlm_host_mutex);
 }
 
@@ -623,27 +623,31 @@ nlm_shutdown_hosts(void)
  * mark & sweep for resources held by remote clients.
  */
 static void
-nlm_gc_hosts(void)
+nlm_gc_hosts(struct net *net)
 {
 	struct hlist_head *chain;
 	struct hlist_node *pos, *next;
 	struct nlm_host	*host;
-	struct net *net = &init_net;
 
-	dprintk("lockd: host garbage collection\n");
-	for_each_host(host, pos, chain, nlm_server_hosts)
+	dprintk("lockd: host garbage collection for net %p\n", net);
+	for_each_host(host, pos, chain, nlm_server_hosts) {
+		if (net && host->net != net)
+			continue;
 		host->h_inuse = 0;
+	}
 
 	/* Mark all hosts that hold locks, blocks or shares */
 	nlmsvc_mark_resources(net);
 
 	for_each_host_safe(host, pos, next, chain, nlm_server_hosts) {
+		if (net && host->net != net)
+			continue;
 		if (atomic_read(&host->h_count) || host->h_inuse
 		 || time_before(jiffies, host->h_expires)) {
 			dprintk("nlm_gc_hosts skipping %s "
-				"(cnt %d use %d exp %ld)\n",
+				"(cnt %d use %d exp %ld net %p)\n",
 				host->h_name, atomic_read(&host->h_count),
-				host->h_inuse, host->h_expires);
+				host->h_inuse, host->h_expires, host->net);
 			continue;
 		}
 		nlm_destroy_host_locked(host);


  parent reply	other threads:[~2012-05-05 17:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-05 17:21 [PATCH RFC 00/13] Lockd: grace period containerization Stanislav Kinsbursky
2012-05-05 17:21 ` [PATCH RFC 01/13] LockD: mark host per network namespace on garbage collect Stanislav Kinsbursky
2012-05-05 17:21 ` Stanislav Kinsbursky [this message]
2012-05-05 17:21 ` [PATCH RFC 03/13] LockD: manage garbage collection timeout per networks namespace Stanislav Kinsbursky
2012-05-05 17:22 ` [PATCH RFC 04/13] LockD: manage used host count " Stanislav Kinsbursky
2012-05-05 17:22 ` [PATCH RFC 05/13] Lockd: host complaining function introduced Stanislav Kinsbursky
2012-05-05 17:22 ` [PATCH RFC 06/13] Lockd: add more debug to host shutdown functions Stanislav Kinsbursky
2012-05-05 17:22 ` [PATCH RFC 07/13] LockD: manage grace period per network namespace Stanislav Kinsbursky
2012-05-05 17:22 ` [PATCH RFC 08/13] LockD: make lockd manager allocated " Stanislav Kinsbursky
2012-05-05 17:22 ` [PATCH RFC 09/13] NFSd: make nfsd4_manager allocated per network namespace context Stanislav Kinsbursky
2012-05-05 17:22 ` [PATCH RFC 10/13] SUNRPC: service request network namespace helper introduced Stanislav Kinsbursky
2012-05-05 17:22 ` [PATCH RFC 11/13] LockD: manage grace list per network namespace Stanislav Kinsbursky
2012-05-05 17:22 ` [PATCH RFC 12/13] LockD: pass actual network namespace to grace period management functions Stanislav Kinsbursky
2012-05-05 17:23 ` [PATCH RFC 13/13] Lockd: move grace period management from lockd() to per-net functions Stanislav Kinsbursky
2012-05-14 13:19 ` [RFC PATCH 14/13] NFSd: make grace end flag per network namespace Stanislav Kinsbursky
2012-05-14 14:00 ` [RFC PATCH 15/13] NFSd: make boot_time variable " Stanislav Kinsbursky
2012-05-16 20:06 ` [PATCH RFC 00/13] Lockd: grace period containerization J. Bruce Fields
2012-05-16 20:54   ` J. Bruce Fields

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=20120505172146.11559.77305.stgit@localhost.localdomain \
    --to=skinsbursky@parallels.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).