* [PATCH 1 of 3] MD RAID10: Prep for DM RAID10 device replacement capability
@ 2012-08-24 18:18 Jonathan Brassow
2012-09-05 2:03 ` NeilBrown
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Brassow @ 2012-08-24 18:18 UTC (permalink / raw)
To: linux-raid; +Cc: neilb, jbrassow
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>
Index: linux-upstream/drivers/md/md.c
===================================================================
--- linux-upstream.orig/drivers/md/md.c
+++ linux-upstream/drivers/md/md.c
@@ -2056,8 +2056,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: linux-upstream/drivers/md/raid10.c
===================================================================
--- linux-upstream.orig/drivers/md/raid10.c
+++ linux-upstream/drivers/md/raid10.c
@@ -1632,7 +1632,7 @@ static int raid10_spare_active(struct md
&& !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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1 of 3] MD RAID10: Prep for DM RAID10 device replacement capability
2012-08-24 18:18 [PATCH 1 of 3] MD RAID10: Prep for DM RAID10 device replacement capability Jonathan Brassow
@ 2012-09-05 2:03 ` NeilBrown
2012-09-05 14:53 ` Brassow Jonathan
0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2012-09-05 2:03 UTC (permalink / raw)
To: Jonathan Brassow; +Cc: linux-raid
[-- Attachment #1: Type: text/plain, Size: 2242 bytes --]
On Fri, 24 Aug 2012 13:18:35 -0500 Jonathan Brassow <jbrassow@redhat.com>
wrote:
> 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>
>
> Index: linux-upstream/drivers/md/md.c
> ===================================================================
> --- linux-upstream.orig/drivers/md/md.c
> +++ linux-upstream/drivers/md/md.c
> @@ -2056,8 +2056,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: linux-upstream/drivers/md/raid10.c
> ===================================================================
> --- linux-upstream.orig/drivers/md/raid10.c
> +++ linux-upstream/drivers/md/raid10.c
> @@ -1632,7 +1632,7 @@ static int raid10_spare_active(struct md
> && !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);
>
This and the other too all look fine - applied. Thanks.
While reviewing I noticed:
if (value > rs->md.raid_disks) {
rs->ti->error = "Invalid rebuild index given";
return -EINVAL;
}
(in the 'rebuild' handling). That should be 'value >= rs->md.raid_disks'
shouldn't it?
If you agree, please send a patch.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1 of 3] MD RAID10: Prep for DM RAID10 device replacement capability
2012-09-05 2:03 ` NeilBrown
@ 2012-09-05 14:53 ` Brassow Jonathan
0 siblings, 0 replies; 3+ messages in thread
From: Brassow Jonathan @ 2012-09-05 14:53 UTC (permalink / raw)
To: NeilBrown; +Cc: linux-raid, Jonathan Brassow
On Sep 4, 2012, at 9:03 PM, NeilBrown wrote:
> While reviewing I noticed:
>
> if (value > rs->md.raid_disks) {
> rs->ti->error = "Invalid rebuild index given";
> return -EINVAL;
> }
>
> (in the 'rebuild' handling). That should be 'value >= rs->md.raid_disks'
> shouldn't it?
> If you agree, please send a patch.
Yes. Thank-you for catching that. Patch coming shortly.
brassow
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-05 14:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-24 18:18 [PATCH 1 of 3] MD RAID10: Prep for DM RAID10 device replacement capability Jonathan Brassow
2012-09-05 2:03 ` NeilBrown
2012-09-05 14:53 ` Brassow Jonathan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).