Skip to content

Commit

Permalink
md/raid1: Allow a failed replacement device to be removed.
Browse files Browse the repository at this point in the history
Replacement devices are stored at a different offset, so look
there too.

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Dec 22, 2011
1 parent 8f19ccb commit b014f14
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,9 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
int number = rdev->raid_disk;
struct mirror_info *p = conf->mirrors+ number;

if (rdev != p->rdev)
p = conf->mirrors + conf->raid_disks + number;

print_conf(conf);
if (rdev == p->rdev) {
if (test_bit(In_sync, &rdev->flags) ||
Expand All @@ -1359,6 +1362,9 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
err = -EBUSY;
p->rdev = rdev;
goto abort;
} else {
clear_bit(Replacement, &rdev->flags);
clear_bit(WantReplacement, &rdev->flags);
}
err = md_integrity_register(mddev);
}
Expand Down

0 comments on commit b014f14

Please sign in to comment.