From 9500e898c63c2c1bbbaa5cb75b196fba5beacee1 Mon Sep 17 00:00:00 2001 From: Christine Caulfield Date: Tue, 24 Mar 2009 11:49:15 +0000 Subject: [PATCH] Block SIGINT & SIGTERM in clvmd subthreads so they don't delay shutdown. Patch from Xinwei Hu, Thanks --- WHATS_NEW | 1 + daemons/clvmd/clvmd.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index c44e8fe3b..36afb10dd 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Block SIGTERM & SIGINT in clvmd subthreads. Detect and conditionally wipe swapspace signatures in pvcreate. Fix maximal volume count check for snapshots if max_lv set for volume group. Fix lvcreate to remove cow volume if the snapshot creation fails. diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 29df42569..fb812ff79 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -372,9 +372,11 @@ int main(int argc, char *argv[]) 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 */ @@ -669,6 +671,11 @@ static void main_loop(int local_sock, int cmd_timeout) { 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; -- 2.43.5