Tags: patch

I've made some further investigations:

With mdadm (3.4-4) this bug does not appear.
This upstream commit [1], which is included in mdadm 3.3.3, fixes this
issue.

Because this behavior can corrupt the array, I ported this patch for
3.3.2-5+deb8u1 and should be available in the next point release.

[1] http://git.neil.brown.name/?p=mdadm.git;a=commit;h=8e7ddc5f50af00e5
69ef115e25c635e2d74e90f0

-- 
Jens Sauer <[email protected]>

GPG Key: 5C0B0084
Fingerprint: 75F3 6232 1F69 82E8 F5E0 D151 850E 2908 5C0B 0084
--- mdadm-3.3.2.orig/Grow.c
+++ mdadm-3.3.2/Grow.c
@@ -853,7 +853,8 @@ int reshape_prepare_fdlist(char *devname
 	for (sd = sra->devs; sd; sd = sd->next) {
 		if (sd->disk.state & (1<<MD_DISK_FAULTY))
 			continue;
-		if (sd->disk.state & (1<<MD_DISK_SYNC)) {
+		if (sd->disk.state & (1<<MD_DISK_SYNC) &&
+		    sd->disk.raid_disk < raid_disks) {
 			char *dn = map_dev(sd->disk.major,
 					   sd->disk.minor, 1);
 			fdlist[sd->disk.raid_disk]
@@ -3216,7 +3217,7 @@ started:
 	d = reshape_prepare_fdlist(devname, sra, odisks,
 				   nrdisks, blocks, backup_file,
 				   fdlist, offsets);
-	if (d < 0) {
+	if (d < odisks) {
 		goto release;
 	}
 	if ((st->ss->manage_reshape == NULL) ||
@@ -3228,7 +3229,7 @@ started:
 				       devname);
 				pr_err(" Please provide one with \"--backup=...\"\n");
 				goto release;
-			} else if (sra->array.spare_disks == 0) {
+			} else if (d == odisks) {
 				pr_err("%s: Cannot grow - "
 					"need a spare or backup-file to backup "
 					"critical section\n", devname);

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to