]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
md/raid10: Fix bug when activating a hot-spare.
authorNeilBrown <neilb@suse.de>
Mon, 31 Oct 2011 01:59:44 +0000 (12:59 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:43:29 +0000 (09:43 -0800)
commit 7fcc7c8acf0fba44d19a713207af7e58267c1179 upstream.

This is a fairly serious bug in RAID10.

When a RAID10 array is degraded and a hot-spare is activated, the
spare does not take up the empty slot, but rather replaces the first
working device.
This is likely to make the array non-functional.   It would normally
be possible to recover the data, but that would need care and is not
guaranteed.

This bug was introduced in commit
   2bb77736ae5dca0a189829fbb7379d43364a9dac
which first appeared in 3.1.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/raid10.c

index 0cd9672cf9cbd6032438d4bcb3503bf4794357fc..1d44228530ab23dc695033356da455f74f4e1bc6 100644 (file)
@@ -1337,7 +1337,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
                mirror_info_t *p = &conf->mirrors[mirror];
                if (p->recovery_disabled == mddev->recovery_disabled)
                        continue;
-               if (!p->rdev)
+               if (p->rdev)
                        continue;
 
                disk_stack_limits(mddev->gendisk, rdev->bdev,