Skip to content

Commit

Permalink
md: fix the test for finding spares in raid5_start_reshape.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
NeilBrown committed Jan 31, 2011
1 parent 87a8dec commit 469518a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -5526,8 +5526,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)
&& !test_bit(Faulty, &rdev->flags))
if (!test_bit(In_sync, &rdev->flags)
&& !test_bit(Faulty, &rdev->flags))
spares++;

if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded)
Expand Down

0 comments on commit 469518a

Please sign in to comment.