[PATCH 0/2] fixes for manually-added spares in raid5

[PATCH 0/2] fixes for manually-added spares in raid5

am 14.01.2011 13:38:24 von adam.kwolek

After patch "md/raid5: handle manually-added spares in start_reshape." spres with set slot are almost used by md for raid5 reshape.
It works this way: before and after reshape process disks number in array is the same, new disks are not used during reshape process.
This is addressed by first patch.

Second problem I've found is for degraded arrays (i.e. takeovered raid0). Scenario is as follow:
1. Create raid0 array using 2 disks
2. add 2 spare disks to container
3. expand capacity to 4 disks in array

In result we will get raid0 build on 3 disks with one spare disk. this is due to fact that disk degradataion is not used
for comparing disks slot number (disk used for degraded slot is considered as present in array)
This is addressed by second patch.

BR
Adam


---

Adam Kwolek (2):
md/raid5: FIX: reshape on degraded devices has wrong configuration
md/raid5: FIX: manually-added spare is not used


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

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

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

am 14.01.2011 13:38:40 von adam.kwolek

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
---

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

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index b98b01c..6dee470 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5528,7 +5528,7 @@ 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 +5589,7 @@ 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html