]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
md/raid1: Allow a failed replacement device to be removed.
authorNeilBrown <neilb@suse.de>
Wed, 9 Nov 2011 00:32:12 +0000 (11:32 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 9 Nov 2011 00:32:12 +0000 (11:32 +1100)
Replacement devices are stored at a different offset, so look
there too.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid1.c

index 97d5ff648eb4fbc6b7436eb8304ae037720c3b86..094819e026ac7e5f10a70763f277dda63d198621 100644 (file)
@@ -1335,6 +1335,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) ||
@@ -1358,6 +1361,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(Replaceable, &rdev->flags);
                }
                err = md_integrity_register(mddev);
        }