summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-12-23 10:17:56 +1100
committerNeilBrown <neilb@suse.de>2011-12-23 10:17:56 +1100
commitb014f14c81bc5db4e40e2a4db10998fd79c1c64c (patch)
tree78c5499e8af9a3e850ca2f93d215c53d55c40003
parent8f19ccb2fd70deb1f278be5e75076074cfddee46 (diff)
downloadlinux-3.10-b014f14c81bc5db4e40e2a4db10998fd79c1c64c.tar.gz
linux-3.10-b014f14c81bc5db4e40e2a4db10998fd79c1c64c.tar.bz2
linux-3.10-b014f14c81bc5db4e40e2a4db10998fd79c1c64c.zip
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: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/md/raid1.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index e7768e37f36..3d9aa0c9282 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -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) ||
@@ -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);
}