]> git.baikalelectronics.ru Git - kernel.git/commitdiff
block: skip bio_check_eod for partition-remapped bios
authorChristoph Hellwig <hch@lst.de>
Mon, 25 Jan 2021 18:39:57 +0000 (19:39 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Jan 2021 18:41:34 +0000 (11:41 -0700)
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: 85774780ef96 ("block: store a block_device pointer in struct bio")
Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c

index 88f6089044326433a137e6915deb6b1f424c2ca5..5e752840b41a1fa80b7146fc7b6f2b9c0a336ec3 100644 (file)
@@ -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