Hi all, I'm running into a problem that clvmd sometimes take a long time to shutdown. The clvmd itself is waiting for select to timeout in main_loop. But since the SIGINT (or SIGTERM) is handled in other threads, select is not interrupted as expected. The attached patch tries to mask SIGINT and SIGTERM in all other threads, to make sure the signal is properly handled in the main_loop. This helps to reduce the chance that we are waiting meaninglessly. Would you please kindly review the patch ?
Index: LVM2.2.02.39/daemons/clvmd/clvmd.c =================================================================== --- LVM2.2.02.39.orig/daemons/clvmd/clvmd.c 2009-03-22 23:03:53.000000000 +0800 +++ LVM2.2.02.39/daemons/clvmd/clvmd.c 2009-03-23 04:26:36.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;
_______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/