]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
MD RAID10: Prep for DM RAID10 device replacement capability
authorJonathan Brassow <jbrassow@redhat.com>
Thu, 27 Sep 2012 02:37:25 +0000 (12:37 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 27 Sep 2012 02:37:25 +0000 (12:37 +1000)
MD RAID10:  Fix a couple potential kernel panics if RAID10 is used by dm-raid

When device-mapper uses the RAID10 personality through dm-raid.c, there is no
'gendisk' structure in mddev and some sysfs information is also not populated.

This patch avoids touching those non-existent structures.

Signed-off-by: Jonathan Brassow <jbrassow@rehdat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c
drivers/md/raid10.c

index b1143dbdef88c394739530c3159002c8972b2daa..f0494d4e77070f9e7bf99febe4a0a63b0353dc0d 100644 (file)
@@ -2081,8 +2081,14 @@ EXPORT_SYMBOL(md_integrity_register);
 /* Disable data integrity if non-capable/non-matching disk is being added */
 void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev)
 {
-       struct blk_integrity *bi_rdev = bdev_get_integrity(rdev->bdev);
-       struct blk_integrity *bi_mddev = blk_get_integrity(mddev->gendisk);
+       struct blk_integrity *bi_rdev;
+       struct blk_integrity *bi_mddev;
+
+       if (!mddev->gendisk)
+               return;
+
+       bi_rdev = bdev_get_integrity(rdev->bdev);
+       bi_mddev = blk_get_integrity(mddev->gendisk);
 
        if (!bi_mddev) /* nothing to do */
                return;
index e4d00f5bdbf7acc78c7b7de25901c5c8b5497704..a456e2e6b72d3fec32988a50b468c13eee5606c8 100644 (file)
@@ -1695,7 +1695,7 @@ static int raid10_spare_active(struct mddev *mddev)
                           && !test_bit(Faulty, &tmp->rdev->flags)
                           && !test_and_set_bit(In_sync, &tmp->rdev->flags)) {
                        count++;
-                       sysfs_notify_dirent(tmp->rdev->sysfs_state);
+                       sysfs_notify_dirent_safe(tmp->rdev->sysfs_state);
                }
        }
        spin_lock_irqsave(&conf->device_lock, flags);