dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/stop-previous-reshape-process-first.patch

b7f731
commit e1b942b9afa9f3310ea19c57caea896af97b557e
b7f731
Author: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
b7f731
Date:   Thu Sep 7 13:01:16 2017 +0200
b7f731
b7f731
    Grow: stop previous reshape process first
b7f731
    
b7f731
    If array is stopped during reshape and assembled again straight away,
b7f731
    reshape process in a background might still be running. systemd doesn't
b7f731
    start a new service if one already exists. If there is a race, previous
b7f731
    process might terminate and new one is not created. Reshape doesn't
b7f731
    continue after assemble.
b7f731
    
b7f731
    Tell systemd to restart the service rather than just start it. It will
b7f731
    assure previous service is stopped first. If it's not running, stopping
b7f731
    has no effect and only new process is started.
b7f731
    
b7f731
    Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
b7f731
    Signed-off-by: Jes Sorensen <jsorensen@fb.com>
b7f731
b7f731
diff --git a/Grow.c b/Grow.c
b7f731
index 534ba80..267b06f 100644
b7f731
--- a/Grow.c
b7f731
+++ b/Grow.c
b7f731
@@ -3003,9 +3003,9 @@ static int continue_via_systemd(char *devnm)
b7f731
 		snprintf(pathbuf, sizeof(pathbuf), "mdadm-grow-continue@%s.service",
b7f731
 			 devnm);
b7f731
 		status = execl("/usr/bin/systemctl", "systemctl",
b7f731
-			       "start",
b7f731
+			       "restart",
b7f731
 			       pathbuf, NULL);
b7f731
-		status = execl("/bin/systemctl", "systemctl", "start",
b7f731
+		status = execl("/bin/systemctl", "systemctl", "restart",
b7f731
 			       pathbuf, NULL);
b7f731
 		exit(1);
b7f731
 	case -1: /* Just do it ourselves. */