From 24459991cecae2cf4786fbeb1c3123ab0714fc65 Mon Sep 17 00:00:00 2001 From: Lon Hohberger <lhh@redhat.com> Date: Thu, 25 Jun 2009 15:27:52 -0400 Subject: [PATCH] rgmanager: Allow exit while waiting for fencing Resolves: bz508147 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); -- 1.6.2.5