Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "dm raid: remove unnecessary discard limits for raid10"

This reverts commit f0e90b6c663a7e3b4736cb318c6c7c589f152c28.

Matthew Ruffell reported data corruption in raid10 due to the changes
in discard handling [1]. Revert these changes before we find a proper fix.

[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1907262/
Cc: Matthew Ruffell <matthew.ruffell@canonical.com>
Cc: Xiao Ni <xni@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Song Liu <songliubraving@fb.com>

Song Liu e2782f56 7e7986f9

+11
+11
drivers/md/dm-raid.c
··· 3728 3728 3729 3729 blk_limits_io_min(limits, chunk_size_bytes); 3730 3730 blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs)); 3731 + 3732 + /* 3733 + * RAID10 personality requires bio splitting, 3734 + * RAID0/1/4/5/6 don't and process large discard bios properly. 3735 + */ 3736 + if (rs_is_raid10(rs)) { 3737 + limits->discard_granularity = max(chunk_size_bytes, 3738 + limits->discard_granularity); 3739 + limits->max_discard_sectors = min_not_zero(rs->md.chunk_sectors, 3740 + limits->max_discard_sectors); 3741 + } 3731 3742 } 3732 3743 3733 3744 static void raid_postsuspend(struct dm_target *ti)