cluster: RHEL59 - rgmanager: Don't exit uncleanly when cman asks us to shut down.

Ryan McCabe rmccabe at fedoraproject.org
Tue Jul 10 19:57:43 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=55710722d15be8f2eafdae472086182f88b2a0d5
Commit:        55710722d15be8f2eafdae472086182f88b2a0d5
Parent:        df45c13985a5219c04356eea98179935ed9efb14
Author:        Ryan McCabe <rmccabe at redhat.com>
AuthorDate:    Thu Jun 28 15:18:09 2012 -0400
Committer:     Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Tue Jul 10 15:55:29 2012 -0400

rgmanager: Don't exit uncleanly when cman asks us to shut down.

Original patch from Lon rediffed to apply to the current tree:

"Previous to this, rgmanager would uncleanly exit if you
issued a 'service cman stop'.  This patch makes it uncleanly
exit if 'cman_tool leave force' or a corosync/openais crash
occurs, but in a simple cman_tool leave, rgmanager will no
longer exit uncleanly."

Without this patch, issuing 'service cman stop' when rgmanager
is running will make it impossible to stop the cman service because
rgmanager will have exited without releasing its dlm lockspace.

This patch causes rgmanager to refuse shutdown when requested
by cman. Users must stop the rgmanager service before stopping
the cman service.

Acked-by: Fabio M. Di Nitto <fdinitto at redhat.com>
Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
---
 rgmanager/src/clulib/msg_cluster.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/rgmanager/src/clulib/msg_cluster.c b/rgmanager/src/clulib/msg_cluster.c
index 8dc22d0..e864853 100644
--- a/rgmanager/src/clulib/msg_cluster.c
+++ b/rgmanager/src/clulib/msg_cluster.c
@@ -211,7 +211,7 @@ poll_cluster_messages(int timeout)
 
 		if (cman_dispatch(ch, 0) < 0) {
 			process_cman_event(ch, NULL,
-					   CMAN_REASON_TRY_SHUTDOWN, 0);
+					   CMAN_REASON_TRY_SHUTDOWN, 1);
 		}
 		ret = 0;
 	}
@@ -987,6 +987,11 @@ process_cman_event(cman_handle_t handle, void *private, int reason, int arg)
 	printf("EVENT: %p %p %d %d\n", handle, private, reason, arg);
 #endif
 
+	if (reason == CMAN_REASON_TRY_SHUTDOWN && !arg) {
+		cman_replyto_shutdown(handle, 0);
+		return;
+	}
+
 	/* Allocate queue node */
 	while ((node = malloc(sizeof(*node))) == NULL) {
 		sleep(1);


More information about the cluster-commits mailing list