Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | From: Martin Wilck <mwilck@suse.com> |
| 3 | Date: Wed, 21 Mar 2018 10:34:19 +0100 |
| 4 | Subject: [PATCH] multipathd: handle errors in uxlsnr as fatal |
| 5 | |
| 6 | The ppoll() calls of the uxlsnr thread are vital for proper functioning of |
| 7 | multipathd. If the uxlsnr thread can't open the socket or fails to call ppoll() |
| 8 | for other reasons, quit the daemon. If we don't do that, multipathd may |
| 9 | hang in a state where it can't be terminated any more, because the uxlsnr |
| 10 | thread is responsible for handling all signals. This happens e.g. if |
| 11 | systemd's multipathd.socket is running in and multipathd is started from |
| 12 | outside systemd. |
| 13 | |
| 14 | 24f2844 "multipathd: fix signal blocking logic" has made this problem more |
| 15 | severe. Before that patch, the signals weren't actually blocked in any thread. |
| 16 | That's not to say 24f2844 was wrong. I still think it's correct, we just |
| 17 | need this one on top. |
| 18 | |
| 19 | Signed-off-by: Martin Wilck <mwilck@suse.com> |
| 20 | Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> |
| 21 | --- |
| 22 | multipathd/uxlsnr.c | 5 +++-- |
| 23 | 1 file changed, 3 insertions(+), 2 deletions(-) |
| 24 | |
| 25 | diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c |
| 26 | index cdafd82..6f66666 100644 |
| 27 | --- a/multipathd/uxlsnr.c |
| 28 | +++ b/multipathd/uxlsnr.c |
| 29 | @@ -178,7 +178,7 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, void * trigger_data) |
| 30 | |
| 31 | if (ux_sock == -1) { |
| 32 | condlog(1, "could not create uxsock: %d", errno); |
| 33 | - return NULL; |
| 34 | + exit_daemon(); |
| 35 | } |
| 36 | |
| 37 | pthread_cleanup_push(uxsock_cleanup, (void *)ux_sock); |
| 38 | @@ -187,7 +187,7 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, void * trigger_data) |
| 39 | polls = (struct pollfd *)MALLOC((MIN_POLLS + 1) * sizeof(struct pollfd)); |
| 40 | if (!polls) { |
| 41 | condlog(0, "uxsock: failed to allocate poll fds"); |
| 42 | - return NULL; |
| 43 | + exit_daemon(); |
| 44 | } |
| 45 | sigfillset(&mask); |
| 46 | sigdelset(&mask, SIGINT); |
| 47 | @@ -249,6 +249,7 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, void * trigger_data) |
| 48 | |
| 49 | /* something went badly wrong! */ |
| 50 | condlog(0, "uxsock: poll failed with %d", errno); |
| 51 | + exit_daemon(); |
| 52 | break; |
| 53 | } |
| 54 | |
| 55 | -- |
| 56 | 2.7.4 |
| 57 | |