Skip to content

Commit 1b0a151

Browse files
YuKuai-huaweiaxboe
authored andcommitted
blk-core: use pr_warn_ratelimited() in bio_check_ro()
If one of the underlying disks of raid or dm is set to read-only, then each io will generate new log, which will cause message storm. This environment is indeed problematic, however we can't make sure our naive custormer won't do this, hence use pr_warn_ratelimited() to prevent message storm in this case. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Fixes: 57e95e4 ("block: fix and cleanup bio_check_ro") Signed-off-by: Ye Bin <yebin10@huawei.com> Link: https://lore.kernel.org/r/20231107111247.2157820-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 3274627 commit 1b0a151

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

block/blk-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ static inline void bio_check_ro(struct bio *bio)
501501
if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev)) {
502502
if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
503503
return;
504-
pr_warn("Trying to write to read-only block-device %pg\n",
505-
bio->bi_bdev);
504+
pr_warn_ratelimited("Trying to write to read-only block-device %pg\n",
505+
bio->bi_bdev);
506506
/* Older lvm-tools actually trigger this */
507507
}
508508
}

0 commit comments

Comments
 (0)