]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: stop previous reshape process first
authorTomasz Majchrzak <tomasz.majchrzak@intel.com>
Thu, 7 Sep 2017 11:01:16 +0000 (13:01 +0200)
committerJes Sorensen <jsorensen@fb.com>
Mon, 2 Oct 2017 19:41:45 +0000 (15:41 -0400)
If array is stopped during reshape and assembled again straight away,
reshape process in a background might still be running. systemd doesn't
start a new service if one already exists. If there is a race, previous
process might terminate and new one is not created. Reshape doesn't
continue after assemble.

Tell systemd to restart the service rather than just start it. It will
assure previous service is stopped first. If it's not running, stopping
has no effect and only new process is started.

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Grow.c

diff --git a/Grow.c b/Grow.c
index 534ba801999838b0b3b61c452f8f61807deb1379..267b06f749f6d26b4aaf967ffa25d41bca052f2e 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -3003,9 +3003,9 @@ static int continue_via_systemd(char *devnm)
                snprintf(pathbuf, sizeof(pathbuf), "mdadm-grow-continue@%s.service",
                         devnm);
                status = execl("/usr/bin/systemctl", "systemctl",
-                              "start",
+                              "restart",
                               pathbuf, NULL);
-               status = execl("/bin/systemctl", "systemctl", "start",
+               status = execl("/bin/systemctl", "systemctl", "restart",
                               pathbuf, NULL);
                exit(1);
        case -1: /* Just do it ourselves. */