Cluster-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lon Hohberger <lhh@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] rgmanager: Allow exit while waiting for fencing
Date: Thu, 25 Jun 2009 17:18:19 -0400	[thread overview]
Message-ID: <1245964699-5288-1-git-send-email-lhh@redhat.com> (raw)

Resolves: 508147

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 rgmanager/src/daemons/main.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 8f9fc2f..88970f1 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -853,20 +853,25 @@ cman_connect(cman_handle_t *ch)
 }
 
 
-static void
+static int
 wait_for_fencing(void)
 {
         if (node_has_fencing(my_id()) && !fence_domain_joined()) {
 		logt_print(LOG_INFO, "Waiting for fence domain join operation "
 		       "to complete\n");
 
-		while (fence_domain_joined() == 0)
+		while (fence_domain_joined() == 0) {
+			if (shutdown_pending)
+				return 1;
 			sleep(1);
+		}
 		logt_print(LOG_INFO, "Fence domain joined\n");
 	} else {
 		logt_print(LOG_DEBUG, "Fence domain already joined "
 		       "or no fencing configured\n");
 	}
+
+	return 0;
 }
 
 
@@ -963,7 +968,8 @@ main(int argc, char **argv)
 
 	logt_print(LOG_INFO, "I am node #%d\n", my_id());
 
-	wait_for_fencing();
+	if (wait_for_fencing() != 0)
+		goto out;
 
 	/*
 	   We know we're quorate.  At this point, we need to
@@ -977,6 +983,9 @@ main(int argc, char **argv)
 		return -1;
 	}
 
+	if (shutdown_pending)
+		goto out;
+
 	if (msg_listen(MSG_SOCKET, RGMGR_SOCK, me.cn_nodeid, &local_ctx) < 0) {
 		logt_print(LOG_CRIT,
 		       "#10: Couldn't set up cluster message system: %s\n",
-- 
1.6.0.6



                 reply	other threads:[~2009-06-25 21:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1245964699-5288-1-git-send-email-lhh@redhat.com \
    --to=lhh@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox