blob: 96a814ff8bac651cf5ddefdd0af408308e7782e2 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Martin Wilck <mwilck@suse.com>
3Date: Wed, 21 Mar 2018 10:34:19 +0100
4Subject: [PATCH] multipathd: handle errors in uxlsnr as fatal
5
6The ppoll() calls of the uxlsnr thread are vital for proper functioning of
7multipathd. If the uxlsnr thread can't open the socket or fails to call ppoll()
8for other reasons, quit the daemon. If we don't do that, multipathd may
9hang in a state where it can't be terminated any more, because the uxlsnr
10thread is responsible for handling all signals. This happens e.g. if
11systemd's multipathd.socket is running in and multipathd is started from
12outside systemd.
13
1424f2844 "multipathd: fix signal blocking logic" has made this problem more
15severe. Before that patch, the signals weren't actually blocked in any thread.
16That's not to say 24f2844 was wrong. I still think it's correct, we just
17need this one on top.
18
19Signed-off-by: Martin Wilck <mwilck@suse.com>
20Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
21---
22 multipathd/uxlsnr.c | 5 +++--
23 1 file changed, 3 insertions(+), 2 deletions(-)
24
25diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c
26index 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--
562.7.4
57