linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: eeeee <tw@qwe123.info>
Cc: linux-raid@vger.kernel.org
Subject: Re: mdadm segfaults on --grow
Date: Sun, 19 Feb 2012 15:00:41 +1100	[thread overview]
Message-ID: <20120219150041.5bc93927@notabene.brown> (raw)
In-Reply-To: <CAPkfHa4LzSC-mBrgKVCEGFuKg5ksOJmv6-ZMiqVnZHf+dRNeRA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]

On Sun, 19 Feb 2012 07:35:08 +0400 eeeee <tw@qwe123.info> wrote:

> i'm doing
> mdadm --grow /dev/md127 -l raid5 -n 6
> and it segfaults!
> 
> mdadm-3.2.3

Thanks for the report.

Can you please check if this fixes the problem?

NeilBrown


diff --git a/Grow.c b/Grow.c
index 53a7cad..8198ac3 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1275,7 +1275,7 @@ char *analyse_change(struct mdinfo *info, struct reshape *re)
 		break;
 
 	case 5:
-		/* We get to RAID5 for RAID5 or RAID6 */
+		/* We get to RAID5 from RAID5 or RAID6 */
 		if (re->level != 5 && re->level != 6)
 			return "Cannot convert to RAID5 from this level";
 
@@ -1297,11 +1297,27 @@ char *analyse_change(struct mdinfo *info, struct reshape *re)
 				char layout[40];
 				char *ls = map_num(r5layout, info->new_layout);
 				int l;
-				strcat(strcpy(layout, ls), "-6");
-				l = map_name(r6layout, layout);
-				if (l == UnSet)
-					return "Cannot find RAID6 layout"
-						" to convert to";
+				if (ls) {
+					/* Current RAID6 layout has a RAID5
+					 * equivalent - good
+					 */
+					strcat(strcpy(layout, ls), "-6");
+					l = map_name(r6layout, layout);
+					if (l == UnSet)
+						return "Cannot find RAID6 layout"
+							" to convert to";
+				} else {
+					/* Current RAID6 has no equivalent.
+					 * If it is already a '-6' layout we
+					 * can leave it unchanged, else we must
+					 * fail
+					 */
+					ls = map_num(r6layout, info->new_layout);
+					if (!ls ||
+					    strcmp(ls+strlen(ls)-2, "-6") != 0)
+						return "Please specify new layout";
+					l = info->new_layout;
+				}
 				re->after.layout = l;
 			}
 		}

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2012-02-19  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-19  3:35 mdadm segfaults on --grow eeeee
2012-02-19  4:00 ` NeilBrown [this message]

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=20120219150041.5bc93927@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=tw@qwe123.info \
    /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).