From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 07/11] lockd: Refactor nlm_host_rebooted()
Date: Thu, 01 Apr 2010 15:03:25 -0400 [thread overview]
Message-ID: <20100401190324.6395.84601.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100401183724.6395.60353.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
We want to be able to call the lock recovery logic directly with an
nsm_handle. Factor that piece out of nlm_host_rebooted().
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/lockd/host.c | 35 ++++++++++++++++++++++++-----------
include/linux/lockd/lockd.h | 2 ++
2 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 0a62d8d..001d05b 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -669,26 +669,39 @@ void nlm_release_host(struct nlm_host *host)
*/
void nlm_host_rebooted(const struct nlm_reboot *info)
{
- struct hlist_head *chain;
- struct hlist_node *pos;
struct nsm_handle *nsm;
- struct nlm_host *host;
nsm = nsm_reboot_lookup(info);
if (unlikely(nsm == NULL))
return;
- /* Mark all hosts tied to this NSM state as having rebooted.
- * We run the loop repeatedly, because we drop the host table
- * lock for this.
- * To avoid processing a host several times, we match the nsmstate.
- */
-again: mutex_lock(&nlm_host_mutex);
+ nlm_host_rebooted_nsm(nsm, info->state);
+}
+
+/**
+ * nlm_host_rebooted_nsm - start reboot recovery on remote peer
+ * @nsm: pointer to NSM handle for rebooting peer
+ * @nsmstate: new NSM state number of rebooting peer
+ *
+ * Mark all hosts tied to this NSM state as having rebooted. We run
+ * the loop repeatedly, because we drop the host table lock for this.
+ *
+ * To avoid processing a host several times, we match the nsmstate.
+ */
+void nlm_host_rebooted_nsm(const struct nsm_handle *nsm, const int nsmstate)
+{
+ struct hlist_head *chain;
+ struct hlist_node *pos;
+ struct nlm_host *host;
+
+again:
+ mutex_lock(&nlm_host_mutex);
+
for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) {
hlist_for_each_entry(host, pos, chain, h_hash) {
if (host->h_nsmhandle == nsm
- && host->h_nsmstate != info->state) {
- host->h_nsmstate = info->state;
+ && host->h_nsmstate != nsmstate) {
+ host->h_nsmstate = nsmstate;
host->h_state++;
nlm_get_host(host);
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 3d1c594..3c20114 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -235,6 +235,8 @@ void nlm_rebind_host(struct nlm_host *);
struct nlm_host * nlm_get_host(struct nlm_host *);
void nlm_release_host(struct nlm_host *);
void nlm_shutdown_hosts(void);
+void nlm_host_rebooted_nsm(const struct nsm_handle *nsm,
+ const int nsmstate);
void nlm_host_rebooted(const struct nlm_reboot *);
/*
next prev parent reply other threads:[~2010-04-01 19:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 19:02 [PATCH 00/11] [RFC] possible NFSv2/v3 lock recovery enhancements Chuck Lever
[not found] ` <20100401183724.6395.60353.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-04-01 19:02 ` [PATCH 01/11] lockd: Add /sys/fs/lockd Chuck Lever
2010-04-01 19:02 ` [PATCH 02/11] lockd: Add /sys/fs/lockd/hosts/ Chuck Lever
2010-04-01 19:02 ` [PATCH 03/11] lockd: Add /sys/fs/lockd/hosts/* Chuck Lever
2010-04-01 19:02 ` [PATCH 04/11] lockd: Add attributes to /sys/fs/lockd/hosts/*/ Chuck Lever
2010-04-01 19:03 ` [PATCH 05/11] lockd: Add /sys/fs/lockd/mon Chuck Lever
2010-04-01 19:03 ` [PATCH 06/11] lockd: Add /sys/fs/lockd/nsm_handle/* Chuck Lever
2010-04-01 19:03 ` Chuck Lever [this message]
2010-04-01 19:03 ` [PATCH 08/11] lockd: Add "reboot" attribute to nsm_handles Chuck Lever
2010-04-01 19:03 ` [PATCH 09/11] lockd: Keep my_name in nsm_handle Chuck Lever
2010-04-01 19:03 ` [PATCH 10/11] lockd: use sm_my_name for nsm_handle lookups Chuck Lever
2010-04-01 19:04 ` [PATCH 11/11] lockd: Allow mount option to specify caller_name Chuck Lever
[not found] ` <20100401190400.6395.52787.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-04-01 19:45 ` Trond Myklebust
[not found] ` <1270151136.13329.8.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-04-01 20:01 ` Trond Myklebust
2010-04-01 21:08 ` 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=20100401190324.6395.84601.stgit@localhost.localdomain \
--to=chuck.lever@oracle.com \
--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