Skip to content

Commit

Permalink
block: skip bio_check_eod for partition-remapped bios
Browse files Browse the repository at this point in the history
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: 309dca3 ("block: store a block_device pointer in struct bio")
Reported-by: Jens Axboe <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Jan 25, 2021
1 parent c42bca9 commit 3a905c3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3a905c3

Please sign in to comment.