[PATCH] block: skip bio_check_eod for partition-remapped bios

Subsystems: block layer, the rest

STALE2025d

2 messages, 2 authors, 2021-01-25 · open the first message on its own page

[PATCH] block: skip bio_check_eod for partition-remapped bios

From: Christoph Hellwig <hch@lst.de>
Date: 2021-01-25 18:41:58

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")
Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 88f60890443264..5e752840b41a1f 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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
-- 
2.29.2

Re: [PATCH] block: skip bio_check_eod for partition-remapped bios

From: Jens Axboe <axboe@kernel.dk>
Date: 2021-01-25 18:44:12

On 1/25/21 11:39 AM, Christoph Hellwig wrote:
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.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help