[PATCH 2/2] md/raid5: FIX: reshape on degraded devices has wrong configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When we performing expansion on degraded array (takeovered raid0),
and we are adding i.e. 2 disks, one disk is added only.

this is due to fact that parity (missing) disk is moved to the end
and added disk index is smaller than starting disk number in array.

To resolve this situation array degradation should be used for adding
disk(s) on reshape start.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 drivers/md/raid5.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 59c4150..3b9da76 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5528,7 +5528,8 @@ static int raid5_start_reshape(mddev_t *mddev)
 		return -ENOSPC;
 
 	list_for_each_entry(rdev, &mddev->disks, same_set)
-		if ((rdev->raid_disk < 0 || rdev->raid_disk >= conf->raid_disks)
+		if ((rdev->raid_disk < 0 ||
+		     rdev->raid_disk >= (conf->raid_disks - mddev->degraded))
 		     && !test_bit(Faulty, &rdev->flags))
 			spares++;
 
@@ -5589,7 +5590,8 @@ static int raid5_start_reshape(mddev_t *mddev)
 					/* Failure here is OK */;
 			} else
 				break;
-		} else if (rdev->raid_disk >= conf->previous_raid_disks
+		} else if (rdev->raid_disk >= (conf->previous_raid_disks
+						- mddev->degraded)
 			   && !test_bit(Faulty, &rdev->flags)) {
 			/* This is a spare that was manually added */
 			if (raid5_add_disk(mddev, rdev) == 0) {

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux