dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm-3.3.2-fix-problem-with-grow-continue.patch

2ddfcf
commit 8e7ddc5f50af00e569ef115e25c635e2d74e90f0
2ddfcf
Author: NeilBrown <neilb@suse.de>
2ddfcf
Date:   Thu May 28 16:43:15 2015 +1000
2ddfcf
2ddfcf
    Grow: fix problem with --grow --continue
2ddfcf
    
2ddfcf
    If an array is being reshaped using backup space on a 'spare' device,
2ddfcf
    then
2ddfcf
      mdadm --grow --continue
2ddfcf
    won't find it as by the time it runs, nothing looks like a spare are
2ddfcf
    more.  The spare has been added to the array, but has no data yet.
2ddfcf
    
2ddfcf
    So allow reshape_prepare_fdlist to find a newly-incorporated spare and
2ddfcf
    report this so it can be used.
2ddfcf
    
2ddfcf
    Reported-by: Xiao Ni <xni@redhat.com>
2ddfcf
    Signed-off-by: NeilBrown <neilb@suse.de>
2ddfcf
2ddfcf
diff --git a/Grow.c b/Grow.c
2ddfcf
index a20ff3e..85de1d2 100644
2ddfcf
--- a/Grow.c
2ddfcf
+++ b/Grow.c
2ddfcf
@@ -850,7 +850,8 @@ int reshape_prepare_fdlist(char *devname,
2ddfcf
 	for (sd = sra->devs; sd; sd = sd->next) {
2ddfcf
 		if (sd->disk.state & (1<
2ddfcf
 			continue;
2ddfcf
-		if (sd->disk.state & (1<
2ddfcf
+		if (sd->disk.state & (1<
2ddfcf
+		    sd->disk.raid_disk < raid_disks) {
2ddfcf
 			char *dn = map_dev(sd->disk.major,
2ddfcf
 					   sd->disk.minor, 1);
2ddfcf
 			fdlist[sd->disk.raid_disk]
2ddfcf
@@ -3184,7 +3185,7 @@ started:
2ddfcf
 	d = reshape_prepare_fdlist(devname, sra, odisks,
2ddfcf
 				   nrdisks, blocks, backup_file,
2ddfcf
 				   fdlist, offsets);
2ddfcf
-	if (d < 0) {
2ddfcf
+	if (d < odisks) {
2ddfcf
 		goto release;
2ddfcf
 	}
2ddfcf
 	if ((st->ss->manage_reshape == NULL) ||
2ddfcf
@@ -3196,7 +3197,7 @@ started:
2ddfcf
 				       devname);
2ddfcf
 				pr_err(" Please provide one with \"--backup=...\"\n");
2ddfcf
 				goto release;
2ddfcf
-			} else if (sra->array.spare_disks == 0) {
2ddfcf
+			} else if (d == odisks) {
2ddfcf
 				pr_err("%s: Cannot grow - "
2ddfcf
					"need a spare or backup-file to backup "
2ddfcf
					"critical section\n", devname);
2ddfcf
 				goto release;
2ddfcf
 			}