Skip to contentSkip to conversation

dm-raid: check for zero feature flags in metadata

PATCH In review [email protected] 3 participants 5 messages Apr 29, 2016 – May 9, 2016 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-raid: check for zero feature flags in metadata

From: Heinz Mauelshagen <[email protected]>

Because we don't support any feature flags in the dm-raid ondisk metadata yet (see struct dm_raid_superblock, 'features' member), this patch adds a check to ensure no flags are actually set or reject the activation of the RAID mapping.

This is to prevent possible data corruption in case of a kernel downgrade when there'll potentially be feature flags set by a future dm-raid target.

---
 drivers/md/dm-raid.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/md/dm-raid.c +4 -0
index a090121..5f05ba0 100644
@@ -1037,6 +1037,10 @@ static int super_validate(struct raid_set *rs, struct md_rdev *rdev)
 	if (!mddev->events && super_init_validation(mddev, rdev))
 		return -EINVAL;
 
+	rs->ti->error = "Unable to assemble array: No feature flags supported yet";
+	if (le32_to_cpu(sb->features)) /* No features supported yet */
+		return -EINVAL;
+
 	/* Enable bitmap creation for RAID levels != 0 */
 	mddev->bitmap_info.offset = (rs->raid_type->level) ? to_sector(4096) : 0;
 	rdev->mddev->bitmap_info.default_offset = mddev->bitmap_info.offset;
Signature · 1 line
2.5.5
#1 lore raw
Quoted 7 lines · On Fri, Apr 29 2016 at 12:59pm -0400, [email protected] <[email protected]>…

From: Heinz Mauelshagen <[email protected]>

Because we don't support any feature flags in the dm-raid ondisk metadata yet (see struct dm_raid_superblock, 'features' member), this patch adds a check to ensure no flags are actually set or reject the activation of the RAID mapping.

Quoted 6 lines

This is to prevent possible data corruption in case of a kernel downgrade when there'll potentially be feature flags set by a future dm-raid target.

merged for 4.7, see:
https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.7&id=480375cd7ea3eed60381539dbfa96851b6174820

#2 lore raw
Quoted 15 lines · Mike Snitzer
Quoted 12 lines · On Fri, Apr 29 2016 at 12:59pm -0400, [email protected] <[email protected]>…

From: Heinz Mauelshagen <[email protected]>

Because we don't support any feature flags in the dm-raid ondisk metadata yet (see struct dm_raid_superblock, 'features' member), this patch adds a check to ensure no flags are actually set or reject the activation of the RAID mapping.

This is to prevent possible data corruption in case of a kernel downgrade when there'll potentially be feature flags set by a future dm-raid target.

Quoted 4 lines
Quoted 1 line

merged for 4.7, see:
https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.7&id=480375cd7ea3eed60381539dbfa96851b6174820

Actually, I revised the header and patch content, see:

https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-4.7&id=ecdb57d205b98b656ab3ea0412f7a15ec003357f

#3 lore raw
In reply to [email protected]

drivers/md/dm-raid.c static int super_validate(struct raid_set *rs, struct md_rdev *rdev) · line 1041

Quoted 2 lines · On Fri, Apr 29, 2016 at 06:59:56PM +0200, [email protected] wrote:
drivers/md/dm-raid.c +2 -0
+	rs->ti->error = "Unable to assemble array: No feature flags supported yet";
+	if (le32_to_cpu(sb->features)) /* No features supported yet */

Is it worth splitting this into compat_flags and incompat_flags like we did in thin and cache?

Alasdair

#4 lore raw
Quoted 5 lines · Alasdair G Kergon

drivers/md/dm-raid.c static int super_validate(struct raid_set *rs, struct md_rdev *rdev) · line 1041

Quoted 2 lines · On Fri, Apr 29, 2016 at 06:59:56PM +0200, [email protected] wrote:
drivers/md/dm-raid.c +2 -0
+	rs->ti->error = "Unable to assemble array: No feature flags supported yet";
+	if (le32_to_cpu(sb->features)) /* No features supported yet */

Is it worth splitting this into compat_flags and incompat_flags like we did in thin and cache?

I'm envisioning a single feature flag for future reshape/takeover functionality. Seems like a good idea still so I'll add this to the RAID superblock metadata changes.

Heinz

Quoted 7 lines

Alasdair

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel