906e1e1128
Modify 0135-RHBZ-1299600-path-dev-uevents.patch * trigger uevents when adding wwids for existing devices during startup Refresh 0136-RHBZ-1304687-wait-for-map-add.patch Refresh 0150-RHBZ-1253913-fix-startup-msg.patch Modify 0159-UPBZ-1255885-udev-waits.patch * fix bug in failure path Add 0160-RH-udev-flags.patch Add 0161-RHBZ-1311659-no-kpartx.patch * skip_kpartx option disables kpartx running on multipath devices Add 0162-RHBZ-1333331-huawei-config.patch * Add default config for Huawei XSG1 array Add 0163-UPBZ-1333492-resize-map.patch * restore old size if resize fails Add 0164-RHBZ-1311463-dos-part-rollover.patch * fix incorrect partition size due to 4k device size rollover Add 0165-UPBZ-1341748-MSA-2040-conf.patch * Add default config for MSA 2040 array Add 0166-RHBZ-1323429-dont-allow-new-wwid.patch * don't allow path wwid to change while it is in use Add 0167-RHBZ-1335176-fix-show-cmds.patch * and new show multipath format wildcard, 'f' to sho number of failures. This will hopefully be useful for tracking what happens to multipath devices for bz #1335176 Add 0168-RHBZ-1347769-shared-lock.patch * make multipath lock the path devices with a shared lock Add 0169-UPBZ-1353357-json-output.patch * add mulitpathd json output command Add 0170-UPBZ-1352925-fix-typo.patch Add 0171-UPBZ-1356651-allow-zero-size.patch * Allow zero-sized paths to be added to a multipath device Add 0172-RHBZ-1350931-no-active-add.patch * Allow paths to be added to a new map if no active paths exist. Also fixes 1351430
129 lines
2.8 KiB
Diff
129 lines
2.8 KiB
Diff
---
|
|
multipathd/main.c | 38 +++++++++++++++++++++++++++++---------
|
|
1 file changed, 29 insertions(+), 9 deletions(-)
|
|
|
|
Index: multipath-tools-130222/multipathd/main.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipathd/main.c
|
|
+++ multipath-tools-130222/multipathd/main.c
|
|
@@ -87,6 +87,7 @@ unsigned int mpath_mx_alloc_len;
|
|
int logsink;
|
|
enum daemon_status running_state;
|
|
pid_t daemon_pid;
|
|
+pid_t parent_pid = -1;
|
|
|
|
static sem_t exit_sem;
|
|
/*
|
|
@@ -1705,6 +1706,12 @@ sigusr2 (int sig)
|
|
}
|
|
|
|
static void
|
|
+sigalrm (int sig)
|
|
+{
|
|
+ exit(0);
|
|
+}
|
|
+
|
|
+static void
|
|
signal_init(void)
|
|
{
|
|
sigset_t set;
|
|
@@ -1807,6 +1814,9 @@ child (void * param)
|
|
}
|
|
|
|
running_state = DAEMON_START;
|
|
+ pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid);
|
|
+ if (parent_pid > 0)
|
|
+ kill(parent_pid, SIGALRM);
|
|
|
|
condlog(2, "--------start up--------");
|
|
condlog(2, "read " DEFAULT_CONFIGFILE);
|
|
@@ -1898,8 +1908,6 @@ child (void * param)
|
|
}
|
|
pthread_attr_destroy(&misc_attr);
|
|
|
|
- /* Startup complete, create logfile */
|
|
- pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid);
|
|
update_timestamp(1);
|
|
/* Ignore errors, we can live without */
|
|
|
|
@@ -1979,7 +1987,10 @@ daemonize(void)
|
|
{
|
|
int pid;
|
|
int dev_null_fd;
|
|
+ struct sigaction oldsig;
|
|
|
|
+ oldsig.sa_handler = signal_set(SIGALRM, sigalrm);
|
|
+ parent_pid = getpid();
|
|
if( (pid = fork()) < 0){
|
|
fprintf(stderr, "Failed first fork : %s\n", strerror(errno));
|
|
return -1;
|
|
@@ -1987,10 +1998,13 @@ daemonize(void)
|
|
else if (pid != 0)
|
|
return pid;
|
|
|
|
+ signal_set(SIGALRM, oldsig.sa_handler);
|
|
setsid();
|
|
|
|
- if ( (pid = fork()) < 0)
|
|
+ if ( (pid = fork()) < 0) {
|
|
fprintf(stderr, "Failed second fork : %s\n", strerror(errno));
|
|
+ goto fail;
|
|
+ }
|
|
else if (pid != 0)
|
|
_exit(0);
|
|
|
|
@@ -2001,30 +2015,34 @@ daemonize(void)
|
|
if (dev_null_fd < 0){
|
|
fprintf(stderr, "cannot open /dev/null for input & output : %s\n",
|
|
strerror(errno));
|
|
- _exit(0);
|
|
+ goto fail;
|
|
}
|
|
|
|
close(STDIN_FILENO);
|
|
if (dup(dev_null_fd) < 0) {
|
|
fprintf(stderr, "cannot dup /dev/null to stdin : %s\n",
|
|
strerror(errno));
|
|
- _exit(0);
|
|
+ goto fail;
|
|
}
|
|
close(STDOUT_FILENO);
|
|
if (dup(dev_null_fd) < 0) {
|
|
fprintf(stderr, "cannot dup /dev/null to stdout : %s\n",
|
|
strerror(errno));
|
|
- _exit(0);
|
|
+ goto fail;
|
|
}
|
|
close(STDERR_FILENO);
|
|
if (dup(dev_null_fd) < 0) {
|
|
fprintf(stderr, "cannot dup /dev/null to stderr : %s\n",
|
|
strerror(errno));
|
|
- _exit(0);
|
|
+ goto fail;
|
|
}
|
|
close(dev_null_fd);
|
|
daemon_pid = getpid();
|
|
return 0;
|
|
+
|
|
+fail:
|
|
+ kill(parent_pid, SIGALRM);
|
|
+ _exit(0);
|
|
}
|
|
|
|
int
|
|
@@ -2103,10 +2121,12 @@ main (int argc, char *argv[])
|
|
if (err < 0)
|
|
/* error */
|
|
exit(1);
|
|
- else if (err > 0)
|
|
+ else if (err > 0) {
|
|
+ /* wait up to 3 seconds for the child to start */
|
|
+ sleep(3);
|
|
/* parent dies */
|
|
exit(0);
|
|
- else
|
|
+ } else
|
|
/* child lives */
|
|
return (child(NULL));
|
|
}
|