SHA256
1
0
forked from pool/lvm2
lvm2/sigterm_in_main_thread.diff

39 lines
1.0 KiB
Diff

Index: LVM2.2.02.39/daemons/clvmd/clvmd.c
===================================================================
--- LVM2.2.02.39.orig/daemons/clvmd/clvmd.c 2009-03-24 19:29:14.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/clvmd.c 2009-03-24 19:34:01.000000000 +0800
@@ -348,9 +348,11 @@
signal(SIGHUP, sighup_handler);
signal(SIGPIPE, SIG_IGN);
- /* Block SIGUSR2 in the main process */
+ /* Block SIGUSR2/SIGINT/SIGTERM in process */
sigemptyset(&ss);
sigaddset(&ss, SIGUSR2);
+ sigaddset(&ss, SIGINT);
+ sigaddset(&ss, SIGTERM);
sigprocmask(SIG_BLOCK, &ss, NULL);
/* Initialise the LVM thread variables */
@@ -633,6 +635,11 @@
{
DEBUGLOG("Using timeout of %d seconds\n", cmd_timeout);
+ sigset_t ss;
+ sigemptyset(&ss);
+ sigaddset(&ss, SIGINT);
+ sigaddset(&ss, SIGTERM);
+ pthread_sigmask(SIG_UNBLOCK, &ss, NULL);
/* Main loop */
while (!quit) {
fd_set in;
@@ -771,6 +778,8 @@
}
closedown:
+
+ pthread_sigmask(SIG_BLOCK, &ss, NULL);
clops->cluster_closedown();
close(local_sock);
}