Skip to contentSkip to conversation

block: bio-integrity: Advance seed correctly for larger interval sizes

PATCH Applied Martin K. Petersen 2 participants 2 messages Feb 4, 2022

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

PATCH 1/1 block: bio-integrity: Advance seed correctly for larger interval sizes

Commit 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed") added code to update the integrity seed value when advancing a bio. However, it failed to take into account that the integrity interval might be larger than the 512-byte block layer sector size. This broke bio splitting on PI devices with 4KB logical blocks.

The seed value should be advanced by bio_integrity_intervals() and not the number of sectors.

Cc Dmitry Monakhov <[email protected]>
Fixes 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed")
---
 block/bio-integrity.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/bio-integrity.c +1 -1
index d25114715459..0827b19820c5 100644
@@ -373,7 +373,7 @@ void bio_integrity_advance(struct bio *bio, unsigned int bytes_done)
 	struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);
 	unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9);
 
-	bip->bip_iter.bi_sector += bytes_done >> 9;
+	bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9);
 	bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes);
 }
 
Signature · 1 line
2.32.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Martin K. Petersen

Commit 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed") added code to update the integrity seed value when advancing a bio. However, it failed to take into account that the integrity interval might be larger than the 512-byte block layer sector size. This broke bio splitting on PI devices with 4KB logical blocks.

[...]

Applied, thanks!

[1/1] block: bio-integrity: Advance seed correctly for larger interval sizes

      commit: b13e0c71856817fca67159b11abac350e41289f5

Best regards,

Signature · 1 line
Jens Axboe