Skip to contentSkip to conversation

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

PATCH New Ryan McCabe 2 participants 2 messages Jun 28, 2012 – Jul 4, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 2/5 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.

Resolves: rhbz#769730

---
 rgmanager/src/clulib/msg_cluster.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
rgmanager/src/clulib/msg_cluster.c +6 -1
index 8dc22d0..e864853 100644
@@ -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);
Signature · 1 line
1.7.10.2
#1 lore raw

PATCH 2/5 rgmanager: Don't exit uncleanly when cman asks us to shut down.

ACK

Quoted 45 lines · Ryan McCabe

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.

Resolves: rhbz#769730

---
 rgmanager/src/clulib/msg_cluster.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
rgmanager/src/clulib/msg_cluster.c +6 -1
index 8dc22d0..e864853 100644
@@ -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);