72 lines
1.8 KiB
Diff
72 lines
1.8 KiB
Diff
|
---
|
||
|
libmultipath/waiter.c | 9 +++++++++
|
||
|
multipathd/main.c | 8 ++++++++
|
||
|
2 files changed, 17 insertions(+)
|
||
|
|
||
|
Index: multipath-tools-130222/libmultipath/waiter.c
|
||
|
===================================================================
|
||
|
--- multipath-tools-130222.orig/libmultipath/waiter.c
|
||
|
+++ multipath-tools-130222/libmultipath/waiter.c
|
||
|
@@ -57,6 +57,7 @@ void stop_waiter_thread (struct multipat
|
||
|
thread = mpp->waiter;
|
||
|
mpp->waiter = (pthread_t)0;
|
||
|
pthread_cancel(thread);
|
||
|
+ pthread_kill(thread, SIGUSR2);
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
@@ -65,6 +66,7 @@ void stop_waiter_thread (struct multipat
|
||
|
*/
|
||
|
int waiteventloop (struct event_thread *waiter)
|
||
|
{
|
||
|
+ sigset_t set, oldset;
|
||
|
int event_nr;
|
||
|
int r;
|
||
|
|
||
|
@@ -97,8 +99,15 @@ int waiteventloop (struct event_thread *
|
||
|
dm_task_no_open_count(waiter->dmt);
|
||
|
|
||
|
/* wait */
|
||
|
+ sigemptyset(&set);
|
||
|
+ sigaddset(&set, SIGUSR2);
|
||
|
+ pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
|
||
|
+
|
||
|
+ pthread_testcancel();
|
||
|
r = dm_task_run(waiter->dmt);
|
||
|
+ pthread_testcancel();
|
||
|
|
||
|
+ pthread_sigmask(SIG_SETMASK, &oldset, NULL);
|
||
|
dm_task_destroy(waiter->dmt);
|
||
|
waiter->dmt = NULL;
|
||
|
|
||
|
Index: multipath-tools-130222/multipathd/main.c
|
||
|
===================================================================
|
||
|
--- multipath-tools-130222.orig/multipathd/main.c
|
||
|
+++ multipath-tools-130222/multipathd/main.c
|
||
|
@@ -1506,6 +1506,12 @@ sigusr1 (int sig)
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
+sigusr2 (int sig)
|
||
|
+{
|
||
|
+ condlog(3, "SIGUSR2 received");
|
||
|
+}
|
||
|
+
|
||
|
+static void
|
||
|
signal_init(void)
|
||
|
{
|
||
|
sigset_t set;
|
||
|
@@ -1513,10 +1519,12 @@ signal_init(void)
|
||
|
sigemptyset(&set);
|
||
|
sigaddset(&set, SIGHUP);
|
||
|
sigaddset(&set, SIGUSR1);
|
||
|
+ sigaddset(&set, SIGUSR2);
|
||
|
pthread_sigmask(SIG_BLOCK, &set, NULL);
|
||
|
|
||
|
signal_set(SIGHUP, sighup);
|
||
|
signal_set(SIGUSR1, sigusr1);
|
||
|
+ signal_set(SIGUSR2, sigusr2);
|
||
|
signal_set(SIGINT, sigend);
|
||
|
signal_set(SIGTERM, sigend);
|
||
|
signal(SIGPIPE, SIG_IGN);
|