Skip to content

Commit

Permalink
md: allow re-add to failed arrays.
Browse files Browse the repository at this point in the history
When an array is failed (some data inaccessible) then there is no
point attempting to add a spare as it could not possibly be recovered.

However that may be value in re-adding a recently removed device.
e.g. if there is a write-intent-bitmap and it is clear, then access
to the data could be restored by this action.

So don't reject a re-add to a failed array for RAID10 and RAID5 (the
only arrays  types that check for a failed array).

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Mar 19, 2012
1 parent 41fe75f commit dc10c64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev)
* very different from resync
*/
return -EBUSY;
if (!enough(conf, -1))
if (rdev->saved_raid_disk < 0 && !enough(conf, -1))
return -EINVAL;

if (rdev->raid_disk >= 0)
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -5361,7 +5361,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev)
if (mddev->recovery_disabled == conf->recovery_disabled)
return -EBUSY;

if (has_failed(conf))
if (rdev->saved_raid_disk < 0 && has_failed(conf))
/* no point adding a device */
return -EINVAL;

Expand Down

0 comments on commit dc10c64

Please sign in to comment.