Skip to contentSkip to conversation

multipathd: fix SIGUSR2 handling

PATCH Applied [email protected] 4 participants 4 messages Dec 29, 2016 – Mar 16, 2017 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipathd: fix SIGUSR2 handling

From: "tang.junhui" <[email protected]>

SIGUSR2 is not blocked by default, it would cause bellow conflict in removing of the last path:
-------------------------------------------------------------

uevent processing thread                 | waiter thread
-----------------------------------------|-------------------
uev_remove_path()                        |   waiteventloop()
  lock(&vecs->lock)                      |
  ev_remove_path()                       |     
    dm_queue_if_no_path()----------------|----> dm_task_run()	
    flush_map()                          |      |
      remove_map_and_stop_waiter()       |      -> pthread_cleanup_push(cleanup_lock, &waiter->vecs->lock);
        _remove_map()                    |         lock(&waiter->vecs->lock)//wait for the locker	
          stop_waiter_thread()           |         
            pthread_cancel(thread)       |          
            pthread_kill(thread,SIGUSR2)-|------> sigusr2 (int sig)
                                         |          condlog()
                                         |          fprintf() //it has test cancel point
                                         |          cleanup_lock() //thread cancel, and pop, which unlock the 
                                         |                           locker of uevent processing thread 

--------------------------------------------------------------
Since SIGUSR2 is only needed when waiter thread running in dm_task_run(), and it has already been unblocked before dm_task_run(), so this patch block SIGUSR2 for other times.

Change-Id I8c46292dc954415764ebbe054498b4f7ea53c1c6
---
 multipathd/main.c | 6 ++++++
 1 file changed, 6 insertions(+)
multipathd/main.c +6 -0
index adc3258..fe69abd 100644
@@ -2181,6 +2181,12 @@ sigusr2 (int sig)
 static void
 signal_init(void)
 {
+	sigset_t set;
+
+	sigemptyset(&set);
+	sigaddset(&set, SIGUSR2);
+	pthread_sigmask(SIG_SETMASK, &set, NULL);
+
 	signal_set(SIGHUP, sighup);
 	signal_set(SIGUSR1, sigusr1);
 	signal_set(SIGUSR2, sigusr2);
Signature · 1 line
2.8.1.windows.1
#1 lore raw
Quoted 4 lines · On Thu, Dec 29, 2016 at 03:56:14PM +0800, [email protected] wrote:

From: "tang.junhui" <[email protected]>

SIGUSR2 is not blocked by default, it would cause bellow conflict in removing of the last path:

ACK

-Ben

Quoted 48 lines

-------------------------------------------------------------

uevent processing thread                 | waiter thread
-----------------------------------------|-------------------
uev_remove_path()                        |   waiteventloop()
  lock(&vecs->lock)                      |
  ev_remove_path()                       |     
    dm_queue_if_no_path()----------------|----> dm_task_run()	
    flush_map()                          |      |
      remove_map_and_stop_waiter()       |      -> pthread_cleanup_push(cleanup_lock, &waiter->vecs->lock);
        _remove_map()                    |         lock(&waiter->vecs->lock)//wait for the locker	
          stop_waiter_thread()           |         
            pthread_cancel(thread)       |          
            pthread_kill(thread,SIGUSR2)-|------> sigusr2 (int sig)
                                         |          condlog()
                                         |          fprintf() //it has test cancel point
                                         |          cleanup_lock() //thread cancel, and pop, which unlock the 
                                         |                           locker of uevent processing thread 

--------------------------------------------------------------
Since SIGUSR2 is only needed when waiter thread running in dm_task_run(), and it has already been unblocked before dm_task_run(), so this patch block SIGUSR2 for other times.

Change-Id I8c46292dc954415764ebbe054498b4f7ea53c1c6
---
 multipathd/main.c | 6 ++++++
 1 file changed, 6 insertions(+)
multipathd/main.c +6 -0
index adc3258..fe69abd 100644
@@ -2181,6 +2181,12 @@ sigusr2 (int sig)
 static void
 signal_init(void)
 {
+	sigset_t set;
+
+	sigemptyset(&set);
+	sigaddset(&set, SIGUSR2);
+	pthread_sigmask(SIG_SETMASK, &set, NULL);
+
 	signal_set(SIGHUP, sighup);
 	signal_set(SIGUSR1, sigusr1);
 	signal_set(SIGUSR2, sigusr2);
Signature · 1 line
2.8.1.windows.1
#2 lore raw
Quoted 7 lines · Benjamin Marzinski
Quoted 4 lines · On Thu, Dec 29, 2016 at 03:56:14PM +0800, [email protected] wrote:

From: "tang.junhui" <[email protected]>

SIGUSR2 is not blocked by default, it would cause bellow conflict in removing of the last path:

ACK

Hello Christophe,

This patch was posted more than two months ago. Do you think it should be reposted?

Thanks,

Bart.

#3 lore raw

Applied.
Thanks.

Quoted 17 lines · Bart Van Assche
Quoted 7 lines · Benjamin Marzinski
Quoted 4 lines · On Thu, Dec 29, 2016 at 03:56:14PM +0800, [email protected] wrote:

From: "tang.junhui" <[email protected]>

SIGUSR2 is not blocked by default, it would cause bellow conflict in removing of the last path:

ACK

Hello Christophe,

This patch was posted more than two months ago. Do you think it should be reposted?

Thanks,

Bart.