History

Merge tag 'for-5.11/revert-problem-v5.10-raid-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull MD regression reverts from Mike Snitzer: "A cascade of MD reverts occurred late in the v5.10-rcX cycle due to MD raid10 discard optimizations having introduced potential for corruption. Those reverts exposed a dm-raid.c compiler warning that wasn't ever knowingly introduced. That min_not_zero() type mismatch warning was thought to be safely fixed simply by changing 'struct mddev' to use 'unsigned int' rather than int for chunk_sectors members in that struct. I proposed either using a cast local to dm-raid.c but thought changing the type to 'unsigned int' more correct. While that may be, not enough testing was paired with code review associated with making that change. As such we were left exposed and the result was a report that with v5.10 btrfs on MD RAID6 failed to mount: https://lkml.org/lkml/2020/12/14/7 Given that report, it is justified to simply revert these offending commits. stable@ has already taken steps to revert these for 5.10.1 - this just makes sure mainline does so too" * tag 'for-5.11/revert-problem-v5.10-raid-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: Revert "dm raid: fix discard limits for raid1 and raid10" Revert "md: change mddev 'chunk_sectors' from int to unsigned"

Linus Torvalds committed 5 years ago

Commit ae1985b2 parents bcc68bd 0941e3b2 files · +7 −9Browse files

Unified · Split

2 files
  1. drivers/md/dm-raid.c +5 −7
  2. drivers/md/md.h +2 −2
drivers/md/dm-raid.c+5−7
@@ -3730,14 +3730,12 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits) · 3729 unmodified lines
37303730 blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs));
37313731
37323732 /*
3733− * RAID10 personality requires bio splitting,
3734− * RAID0/1/4/5/6 don't and process large discard bios properly.
3733+ * RAID1 and RAID10 personalities require bio splitting,
3734+ * RAID0/4/5/6 don't and process large discard bios properly.
37353735 */
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);
3736+ if (rs_is_raid1(rs) || rs_is_raid10(rs)) {
3737+ limits->discard_granularity = chunk_size_bytes;
3738+ limits->max_discard_sectors = rs->md.chunk_sectors;
37413739 }
37423740 }
37433741
drivers/md/md.h+2−2
@@ -311,7 +311,7 @@ struct mddev { · 310 unmodified lines
311311 int external; /* metadata is
312312 * managed externally */
313313 char metadata_type[17]; /* externally set*/
314− unsigned int chunk_sectors;
314+ int chunk_sectors;
315315 time64_t ctime, utime;
316316 int level, layout;
317317 char clevel[16];
@@ -339,7 +339,7 @@ struct mddev { · 21 unmodified lines
339339 */
340340 sector_t reshape_position;
341341 int delta_disks, new_level, new_layout;
342− unsigned int new_chunk_sectors;
342+ int new_chunk_sectors;
343343 int reshape_backwards;
344344
345345 struct md_thread *thread; /* management thread */