linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Ni <xni@redhat.com>
To: linux-raid@vger.kernel.org
Subject: [mdadm PATCH] Grow raid disks without backup file fail
Date: Tue,  1 Dec 2015 15:42:22 +0800	[thread overview]
Message-ID: <1448955742-8317-1-git-send-email-xni@redhat.com> (raw)

Hi Neil

When add one new disk to a raid5 and try to grow the number members,
it's failed to start reshape.

Because before echo "reshape" to sync_action, raid5d will miss the 
chance to clear MD_RECOVERY_NEEDED. The method is as same as
start_reshape.

Signed-off-by : Xiao Ni (xni@redhat.com)
---
 Grow.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Grow.c b/Grow.c
index 80d7b22..a5bed3c 100644
--- a/Grow.c
+++ b/Grow.c
@@ -2796,6 +2796,7 @@ static int reshape_array(char *container, int fd, char *devname,
 	int done;
 	struct mdinfo *sra = NULL;
 	char buf[20];
+	int cnt = 5;
 
 	/* when reshaping a RAID0, the component_size might be zero.
 	 * So try to fix that up.
@@ -3114,7 +3115,12 @@ static int reshape_array(char *container, int fd, char *devname,
 		if (impose_reshape(sra, info, st, fd, restart,
 				   devname, container, &reshape) < 0)
 			goto release;
-		if (sysfs_set_str(sra, NULL, "sync_action", "reshape") < 0) {
+		do {
+			err = sysfs_set_str(sra, NULL, "sync_action", "reshape");
+			if (err)
+				sleep(1);
+		} while (err && errno == EBUSY && cnt-- > 0);
+		if (err < 0) {
 			struct mdinfo *sd;
 			if (errno != EINVAL) {
 				pr_err("Failed to initiate reshape!\n");
-- 
2.4.3


                 reply	other threads:[~2015-12-01  7:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1448955742-8317-1-git-send-email-xni@redhat.com \
    --to=xni@redhat.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).