public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: RHEL5 - rgmanager: Allow exit while waiting for fencing
Date: Thu, 25 Jun 2009 20:03:00 -0000	[thread overview]
Message-ID: <20090625200258.AA9181201ED@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=6fbdf268d92e2d3567f452c9e92e3898b58564ac
Commit:        6fbdf268d92e2d3567f452c9e92e3898b58564ac
Parent:        5b0b8f8002f1ab4b4a8cfff92649d9ed50746795
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Thu Jun 25 15:27:52 2009 -0400
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Thu Jun 25 16:02:36 2009 -0400

rgmanager: Allow exit while waiting for fencing

Resolves: 508147

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

diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index 94de2d3..d795bab 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -952,20 +952,25 @@ clu_initialize(cman_handle_t *ch)
 }
 
 
-void
+int
 wait_for_fencing(void)
 {
         if (node_has_fencing(my_id()) && !fence_domain_joined()) {
 		clulog(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);
+		}
 		clulog(LOG_INFO, "Fence domain joined\n");
 	} else {
 		clulog(LOG_DEBUG, "Fence domain already joined "
 		       "or no fencing configured\n");
 	}
+
+	return 0;
 }
 
 
@@ -1057,6 +1062,7 @@ main(int argc, char **argv)
 	}
 
 	if (clu_lock_init(rgmanager_lsname) != 0) {
+		cman_finish(clu);
 		printf("Locks not working!\n");
 		return -1;
 	}
@@ -1073,7 +1079,8 @@ main(int argc, char **argv)
 
 	clulog(LOG_INFO, "I am node #%d\n", my_id());
 
-	wait_for_fencing();
+	if (wait_for_fencing() != 0)
+		goto out_cleanup;
 
 	/*
 	   We know we're quorate.  At this point, we need to
@@ -1087,6 +1094,9 @@ main(int argc, char **argv)
 		return -1;
 	}
 
+	if (shutdown_pending)
+		goto out_cleanup;
+
 	if (msg_listen(MSG_SOCKET, RGMGR_SOCK, me.cn_nodeid, &local_ctx) < 0) {
 		clulog(LOG_CRIT,
 		       "#10: Couldn't set up cluster message system: %s\n",
@@ -1146,6 +1156,8 @@ main(int argc, char **argv)
 
 	if (rg_initialized())
 		cleanup(cluster_ctx);
+
+out_cleanup:
 	clulog(LOG_NOTICE, "Shutdown complete, exiting\n");
 	clu_lock_finished(rgmanager_lsname);
 	cman_finish(clu);


                 reply	other threads:[~2009-06-25 20:03 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=20090625200258.AA9181201ED@lists.fedorahosted.org \
    --to=lon@fedoraproject.org \
    --cc=cluster-cvs-relay@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).