block: reset bi_iter.bi_done after splitting bio
PATCH 1/1 block: reset bi_iter.bi_done after splitting bio
After the bio has been updated to represent the remaining sectors, reset bi_done so bio_rewind_iter() does not rewind further than it should.
This resolves a bio_integrity_process() failure on reads where the original request was split.
Fixes 63573e359d05 ("bio-integrity: Restore original iterator on verify stage")
Signed-off-by Greg Edwards <[email protected]>
---
Simple test case:
# modprobe scsi_debug.ko dif=1 dix=1 guard=0 dev_size_mb=1024 sector_size=4096 # echo 512 > /sys/block/<device>/queue/max_sectors_kb # dd if=/dev/<device> of=/dev/null bs=1M iflag=direct count=1
block/bio.c | 1 + 1 file changed, 1 insertion(+)
block/bio.c +1 -0
@@ -1866,6 +1866,7 @@ struct bio *bio_split(struct bio *bio, int sectors,bio_integrity_trim (split);bio_advance (bio, split->bi_iter.bi_size); + bio->bi_iter.bi_done =0 ;if (bio_flagged (bio,BIO_TRACE_COMPLETION ))bio_set_flag (split,BIO_TRACE_COMPLETION );
Signature · 1 line
2.17.1
Jens Axboe
maintainerQuoted 5 lines · Greg Edwards
After the bio has been updated to represent the remaining sectors, reset
bi_donesobio_rewind_iter()does not rewind further than it should.This resolves a
bio_integrity_process()failure on reads where the original request was split.
Applied for 4.18, thanks.
Signature · 1 line
Jens Axboe