]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm-raid: don't set io_min and io_opt for raid1
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 15 Sep 2025 14:12:40 +0000 (16:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Sep 2025 09:16:46 +0000 (11:16 +0200)
commit a86556264696b797d94238d99d8284d0d34ed960 upstream.

These commands
 modprobe brd rd_size=1048576
 vgcreate vg /dev/ram*
 lvcreate -m4 -L10 -n lv vg
trigger the following warnings:
device-mapper: table: 252:10: adding target device (start sect 0 len 24576) caused an alignment inconsistency
device-mapper: table: 252:10: adding target device (start sect 0 len 24576) caused an alignment inconsistency

The warnings are caused by the fact that io_min is 512 and physical block
size is 4096.

If there's chunk-less raid, such as raid1, io_min shouldn't be set to zero
because it would be raised to 512 and it would trigger the warning.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-raid.c

index 9835f2fe26e99fe11ae6d301d1c173e4fa5baabc..1e09b4860a45434fc2bc9ae1e73dfe17f3f419b5 100644 (file)
@@ -3810,8 +3810,10 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
        struct raid_set *rs = ti->private;
        unsigned int chunk_size_bytes = to_bytes(rs->md.chunk_sectors);
 
-       limits->io_min = chunk_size_bytes;
-       limits->io_opt = chunk_size_bytes * mddev_data_stripes(rs);
+       if (chunk_size_bytes) {
+               limits->io_min = chunk_size_bytes;
+               limits->io_opt = chunk_size_bytes * mddev_data_stripes(rs);
+       }
 }
 
 static void raid_presuspend(struct dm_target *ti)