Commit b014f14c authored by NeilBrown's avatar NeilBrown

md/raid1: Allow a failed replacement device to be removed.

Replacement devices are stored at a different offset, so look
there too.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 8f19ccb2
...@@ -1336,6 +1336,9 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev) ...@@ -1336,6 +1336,9 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
int number = rdev->raid_disk; int number = rdev->raid_disk;
struct mirror_info *p = conf->mirrors+ number; struct mirror_info *p = conf->mirrors+ number;
if (rdev != p->rdev)
p = conf->mirrors + conf->raid_disks + number;
print_conf(conf); print_conf(conf);
if (rdev == p->rdev) { if (rdev == p->rdev) {
if (test_bit(In_sync, &rdev->flags) || if (test_bit(In_sync, &rdev->flags) ||
...@@ -1359,6 +1362,9 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev) ...@@ -1359,6 +1362,9 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
err = -EBUSY; err = -EBUSY;
p->rdev = rdev; p->rdev = rdev;
goto abort; goto abort;
} else {
clear_bit(Replacement, &rdev->flags);
clear_bit(WantReplacement, &rdev->flags);
} }
err = md_integrity_register(mddev); err = md_integrity_register(mddev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment