>On Monday, November 18th, 2024 at 1:27 PM, Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote: > Hi > Please apply this patch and report what it prints. So, that we can find > out which limits cause the problem. > Mikulas Hello, Sorry for the delay, with patch applied to 6.12.0 released today: dmesg output after running luksOpen on hdd (sda) [ 109.421097] failure 4: fffe00, 1000 [ 109.421112] device-mapper: table: 254:1: adding target device sda1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=16777216 [ 109.421123] failure 4: fffe00, 1000 [ 109.421126] device-mapper: table: 254:1: adding target device sda1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=16777216 [ 109.421379] failure 4: fffe00, 1000 [ 109.421384] device-mapper: table: 254:1: adding target device sda1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=16777216 [ 109.421392] failure 4: fffe00, 1000 [ 109.421395] device-mapper: table: 254:1: adding target device sda1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=16777216 >Hi >Does this patch fix it? --- block/blk-settings.c | 7 +++++++ 1 file changed, 7 insertions(+) Index: linux-2.6/block/blk-settings.c =================================================================== --- linux-2.6.orig/block/blk-settings.c 2024-11-18 15:24:18.000000000 +0100 +++ linux-2.6/block/blk-settings.c 2024-11-18 15:29:24.000000000 +0100 @@ -250,6 +250,13 @@ static int blk_validate_limits(struct qu lim->io_min = lim->physical_block_size; /* + * The optimal I/O size may not be aligned to physical block size + * (because it may be limited by dma engines which have no clue about + * block size of the disks attached to them), so we round it down here. + */ + lim->io_opt = round_down(lim->io_opt, lim->physical_block_size); + + /* * max_hw_sectors has a somewhat weird default for historical reason, * but driver really should set their own instead of relying on this * value. ---- Yes! With the above patch applied (blk-settings: round down io_opt to physical_block_size) No more "device-mapper inconsistency" when I unlock my hdd, I also tried the other hdd to make sure. All good. lsblk -t NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE RA WSAME sda 0 4096 16773120 4096 512 1 bfq 256 32760 0B └─sda1 0 4096 16773120 4096 512 1 bfq 256 32760 0B └─raid-hdd4 0 4096 16773120 4096 4096 1 32760 0B sdb 0 4096 16773120 4096 512 1 bfq 256 32760 0B └─sdb1 0 4096 16773120 4096 512 1 bfq 256 32760 0B └─raid-hdd3 0 4096 16773120 4096 4096 1 32760 0B sdc 0 4096 16773120 4096 512 1 bfq 256 32760 0B └─sdc1 0 4096 16773120 4096 512 1 bfq 256 32760 0B └─raid-hdd2 0 4096 16773120 4096 4096 1 32760 0B sdd 0 4096 16773120 4096 512 1 bfq 256 32760 0B └─sdd1 0 4096 16773120 4096 512 1 bfq 256 32760 0B └─raid-hdd1 0 4096 16773120 4096 4096 1 32760 0B Thanks!