linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
To: linux-raid@vger.kernel.org
Cc: jes.sorensen@gmail.com, Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Subject: [PATCH] Grow: stop previous reshape process first
Date: Thu,  7 Sep 2017 13:01:16 +0200	[thread overview]
Message-ID: <1504782076-1664-1-git-send-email-tomasz.majchrzak@intel.com> (raw)

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>
---
 Grow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Grow.c b/Grow.c
index 534ba80..267b06f 100644
--- 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. */
-- 
1.8.3.1


             reply	other threads:[~2017-09-07 11:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07 11:01 Tomasz Majchrzak [this message]
2017-10-02 19:42 ` [PATCH] Grow: stop previous reshape process first Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1504782076-1664-1-git-send-email-tomasz.majchrzak@intel.com \
    --to=tomasz.majchrzak@intel.com \
    --cc=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).