block: tone down bio_check_eod
authorChristoph Hellwig <hch@lst.de>
Mon, 18 Aug 2025 10:11:02 +0000 (12:11 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Aug 2025 19:27:05 +0000 (13:27 -0600)
bdev_nr_sectors() == 0 is a pattern used for block devices that have
been hot removed, don't spam the log about them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250818101102.1604551-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c

index fdac48aec5efb3de81e5a46ebc9099e7f8ec6b4d..4201504158a17e0a8a188e87ae096e0067c487f1 100644 (file)
@@ -557,7 +557,7 @@ static inline int bio_check_eod(struct bio *bio)
        sector_t maxsector = bdev_nr_sectors(bio->bi_bdev);
        unsigned int nr_sectors = bio_sectors(bio);
 
-       if (nr_sectors &&
+       if (nr_sectors && maxsector &&
            (nr_sectors > maxsector ||
             bio->bi_iter.bi_sector > maxsector - nr_sectors)) {
                pr_info_ratelimited("%s: attempt to access beyond end of device\n"