Skip to contentSkip to conversation

dm verity: fix unaligned block size

PATCH In review Jaegeuk Kim 1 participant 2 messages Apr 10, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm verity: fix unaligned block size

From: Jaegeuk Kim <[email protected]>

When f->roots is 2 and block size is 4096, it will gives unaligned block size length in the scsi command like below. Let's allocate dm_bufio to set the block size length to match IO chunk size.

E sd 0 : 0:0:0: [sda] tag#30 request not aligned to the logical block size
E blk_update_request: I/O error, dev sda, sector 10368424 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0 E device-mapper: verity-fec: 254:8: FEC 9244672: parity read failed (block 18056): -5

Fixes ce1cca17381f ("dm verity: fix FEC for RS roots unaligned to block size")
---
 drivers/md/dm-verity-fec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-verity-fec.c +1 -1
index 66f4c6398f67..656238131dd7 100644
@@ -743,7 +743,7 @@ int verity_fec_ctr(struct dm_verity *v)
 	}
 
 	f->bufio = dm_bufio_client_create(f->dev->bdev,
-					  f->roots << SECTOR_SHIFT,
+					  1 << v->data_dev_block_bits,
 					  1, 0, NULL, NULL);
 	if (IS_ERR(f->bufio)) {
 		ti->error = "Cannot initialize FEC bufio client";
Signature · 1 line
2.31.1.295.g9ea45b61b8-goog
#1 lore raw

Sorry, this patch is totally wrong. Let me dig out more.

Quoted 32 lines · Jaegeuk Kim

From: Jaegeuk Kim <[email protected]>

When f->roots is 2 and block size is 4096, it will gives unaligned block size length in the scsi command like below. Let's allocate dm_bufio to set the block size length to match IO chunk size.

E sd 0 : 0:0:0: [sda] tag#30 request not aligned to the logical block size
E blk_update_request: I/O error, dev sda, sector 10368424 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0 E device-mapper: verity-fec: 254:8: FEC 9244672: parity read failed (block 18056): -5

Fixes ce1cca17381f ("dm verity: fix FEC for RS roots unaligned to block size")
---
 drivers/md/dm-verity-fec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-verity-fec.c +1 -1
index 66f4c6398f67..656238131dd7 100644
@@ -743,7 +743,7 @@ int verity_fec_ctr(struct dm_verity *v)
 	}
 
 	f->bufio = dm_bufio_client_create(f->dev->bdev,
-					  f->roots << SECTOR_SHIFT,
+					  1 << v->data_dev_block_bits,
 					  1, 0, NULL, NULL);
 	if (IS_ERR(f->bufio)) {
 		ti->error = "Cannot initialize FEC bufio client";
Signature · 1 line
2.31.1.295.g9ea45b61b8-goog