aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-01-30 19:57:43 -0500
committerNeilBrown <neilb@suse.de>2011-01-30 19:57:43 -0500
commit469518a3455c79619e9231aeffeffa2e2989f738 (patch)
treeae92280e8be9df25fd20fea87efcbe72bd855ae9 /drivers/md
parent87a8dec91e15954f0cf86be6c21741d991d83621 (diff)
md: fix the test for finding spares in raid5_start_reshape.
As spares can be added to the array before the reshape is started, we need to find and count them when checking there are enough. The array could have been degraded, so we need to check all devices, no just those out side of the range of devices in the array before the reshape. So instead of checking the index, check the In_sync flag as that reliably tells if the device is a spare or this purpose. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index fa5519389a17..a6d2c3ddeee4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5526,8 +5526,8 @@ static int raid5_start_reshape(mddev_t *mddev)
5526 return -ENOSPC; 5526 return -ENOSPC;
5527 5527
5528 list_for_each_entry(rdev, &mddev->disks, same_set) 5528 list_for_each_entry(rdev, &mddev->disks, same_set)
5529 if ((rdev->raid_disk < 0 || rdev->raid_disk >= conf->raid_disks) 5529 if (!test_bit(In_sync, &rdev->flags)
5530 && !test_bit(Faulty, &rdev->flags)) 5530 && !test_bit(Faulty, &rdev->flags))
5531 spares++; 5531 spares++;
5532 5532
5533 if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded) 5533 if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded)