Blame SOURCES/0043-RH-signal-waiter.patch

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