Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2863b9eb authored by Jonathan Brassow's avatar Jonathan Brassow Committed by NeilBrown
Browse files

MD RAID10: Prep for DM RAID10 device replacement capability



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: default avatarJonathan Brassow <jbrassow@rehdat.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 1ca69c4b
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -2044,8 +2044,14 @@ EXPORT_SYMBOL(md_integrity_register);
/* Disable data integrity if non-capable/non-matching disk is being added */
/* Disable data integrity if non-capable/non-matching disk is being added */
void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev)
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_rdev;
	struct blk_integrity *bi_mddev = blk_get_integrity(mddev->gendisk);
	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 */
	if (!bi_mddev) /* nothing to do */
		return;
		return;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1694,7 +1694,7 @@ static int raid10_spare_active(struct mddev *mddev)
			   && !test_bit(Faulty, &tmp->rdev->flags)
			   && !test_bit(Faulty, &tmp->rdev->flags)
			   && !test_and_set_bit(In_sync, &tmp->rdev->flags)) {
			   && !test_and_set_bit(In_sync, &tmp->rdev->flags)) {
			count++;
			count++;
			sysfs_notify_dirent(tmp->rdev->sysfs_state);
			sysfs_notify_dirent_safe(tmp->rdev->sysfs_state);
		}
		}
	}
	}
	spin_lock_irqsave(&conf->device_lock, flags);
	spin_lock_irqsave(&conf->device_lock, flags);