cluster: STABLE3 - Cman: Handle INT and TERM signals correctly

Jan Friesse honzaf at fedoraproject.org
Wed Sep 29 10:24:34 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=de0a199f499bec83774ad88765c5e7df487913e9
Commit:        de0a199f499bec83774ad88765c5e7df487913e9
Parent:        c09852206f21ed04806211e49ca9423e10fea1f9
Author:        Jan Friesse <jfriesse at redhat.com>
AuthorDate:    Mon Sep 27 15:27:59 2010 +0200
Committer:     Jan Friesse <jfriesse at redhat.com>
CommitterDate: Wed Sep 29 12:23:45 2010 +0200

Cman: Handle INT and TERM signals correctly

Corosync signal handler (SIGINT and SIGTERM) is replaced by cman one,
and this was settting quit_threads to 1. Regular cman shutdown sequence
(cman_tool leave) tests if quit_threads is set or not. If so, it refuses
continue so it was not possible to cleanly leave cluster.

Now SIGINT and SIGTERM are ignored, and (un)intentional kill of corosync
is no longer problem.

Resolves: rhbz#617234
---
 cman/daemon/daemon.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/cman/daemon/daemon.c b/cman/daemon/daemon.c
index 64607cc..92cfd47 100644
--- a/cman/daemon/daemon.c
+++ b/cman/daemon/daemon.c
@@ -489,11 +489,6 @@ int num_listeners(void)
 	return count;
 }
 
-static void sigint_handler(int ignored)
-{
-	quit_threads = 1;
-}
-
 int cman_init(struct corosync_api_v1 *api)
 {
 	int fd;
@@ -514,12 +509,10 @@ int cman_init(struct corosync_api_v1 *api)
 		return -2;
 
 	/* Shutdown trap */
-	sa.sa_handler = sigint_handler;
-	sigaction(SIGINT, &sa, NULL);
-	sigaction(SIGTERM, &sa, NULL);
-
 	sa.sa_handler = SIG_IGN;
 	sigaction(SIGPIPE, &sa, NULL);
+	sigaction(SIGINT, &sa, NULL);
+	sigaction(SIGTERM, &sa, NULL);
 
 	return 0;
 }


More information about the cluster-commits mailing list