device-mapper-multipath/0049-multipathd-child-call-cleanups-in-failure-case-too.patch
Benjamin Marzinski b05147c356 device-mapper-multipath-0.8.5-6
Change patch format to remove Git version
  * Patches 0001-0122 only have the patch format modified
Update to the head of the upstream staging branch plus redhat patches
  * Patches 0123-0134 & 1036-0142 are from the upstream staging branch
  * Patches 0143-1046 have been submitted upstream
  * Patch 0156 is a Red Hat only patch. Red Hat udev rules set ID_SERIAL
    from 60-persistent-storage.rules instead of 55-scsi-sg3_id.rules.
    Multipath's parse_vpd_pg83() function needs to match the ID_SERIAL
    value from udev.
Rename files
  * Previous patches 0123-0132 are now patches 1035 & 0147-0155
2021-03-26 13:33:56 -05:00

50 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 23 Sep 2020 17:57:16 +0200
Subject: [PATCH] multipathd: child(): call cleanups in failure case, too
So far we haven't called any cleanup code if child() failed.
Fix it.
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 07068e4a..6b9e323e 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -3044,6 +3044,7 @@ child (__attribute__((unused)) void *param)
struct config *conf;
char *envp;
enum daemon_status state;
+ int exit_code = 1;
mlockall(MCL_CURRENT | MCL_FUTURE);
signal_init();
@@ -3207,6 +3208,8 @@ child (__attribute__((unused)) void *param)
}
}
+ exit_code = 0;
+failed:
cleanup_threads();
cleanup_vecs();
cleanup_foreign();
@@ -3227,12 +3230,7 @@ child (__attribute__((unused)) void *param)
#ifdef _DEBUG_
dbg_free_final(NULL);
#endif
- exit(sd_notify_exit(0));
-
-failed:
- if (pid_fd >= 0)
- close(pid_fd);
- exit(sd_notify_exit(1));
+ return sd_notify_exit(exit_code);
}
static int