multipathd: issue systemd READY after initial configuration
authorHannes Reinecke <hare@suse.de>
Tue, 28 Feb 2017 16:23:07 +0000 (17:23 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 16 Mar 2017 07:02:23 +0000 (08:02 +0100)
We should be issueing systemd READY only after the initial
configuration has been completed, otherwise systemd might
continue while the multipath devices are not setup up properly.

Signed-off-by: Hannes Reinecke <hare@suse.com>
multipathd/main.c

index 3dce12d..3534afb 100644 (file)
@@ -2344,6 +2344,7 @@ child (void * param)
        int i;
 #ifdef USE_SYSTEMD
        unsigned long checkint;
+       int startup_done = 0;
 #endif
        int rc;
        int pid_fd = -1;
@@ -2492,10 +2493,6 @@ child (void * param)
        }
        pthread_attr_destroy(&misc_attr);
 
-#ifdef USE_SYSTEMD
-       sd_notify(0, "READY=1");
-#endif
-
        while (running_state != DAEMON_SHUTDOWN) {
                pthread_cleanup_push(config_cleanup, NULL);
                pthread_mutex_lock(&config_lock);
@@ -2517,6 +2514,12 @@ child (void * param)
                        }
                        lock_cleanup_pop(vecs->lock);
                        post_config_state(DAEMON_IDLE);
+#ifdef USE_SYSTEMD
+                       if (!startup_done) {
+                               sd_notify(0, "READY=1");
+                               startup_done = 1;
+                       }
+#endif
                }
        }