Skip to contentSkip to conversation

block: skip bio_check_eod for partition-remapped bios

PATCH Applied Christoph Hellwig 2 participants 2 messages Jan 25, 2021 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: skip bio_check_eod for partition-remapped bios

When an already remapped bio is resubmitted (e.g. by blk_queue_split), bio_check_eod will compare the remapped bi_sector against the size of the partition, leading to spurious I/O failures.

Skip the EOD check in this case.

Fixes 309dca309fc3 ("block: store a block_device pointer in struct bio")
---
 block/blk-core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
block/blk-core.c +6 -5
index 88f60890443264..5e752840b41a1f 100644
@@ -815,11 +815,12 @@ static noinline_for_stack bool submit_bio_checks(struct bio *bio)
 		goto end_io;
 	if (unlikely(bio_check_ro(bio)))
 		goto end_io;
-	if (unlikely(bio_check_eod(bio)))
-		goto end_io;
-	if (bio->bi_bdev->bd_partno && !bio_flagged(bio, BIO_REMAPPED) &&
-	    unlikely(blk_partition_remap(bio)))
-		goto end_io;
+	if (!bio_flagged(bio, BIO_REMAPPED)) {
+		if (unlikely(bio_check_eod(bio)))
+			goto end_io;
+		if (bdev->bd_partno && unlikely(blk_partition_remap(bio)))
+			goto end_io;
+	}
 
 	/*
 	 * Filter flush bio's early so that bio based drivers without flush
Signature · 1 line
2.29.2
maintainer Applied
#1 lore raw
Quoted 5 lines · Christoph Hellwig

When an already remapped bio is resubmitted (e.g. by blk_queue_split), bio_check_eod will compare the remapped bi_sector against the size of the partition, leading to spurious I/O failures.

Skip the EOD check in this case.

Applied, thanks.

Signature · 1 line
Jens Axboe