summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2023-11-07 14:12:47 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-20 13:52:17 +0300
commit46c541fa66809d166427f8c465d126ff90c6dfcd (patch)
tree09691ed820889e2dfc9ab9283a41150103b2b3f4 /block
parent4e9b3ec84dc97909876641dad14e0a2300d6c2a3 (diff)
downloadlinux-46c541fa66809d166427f8c465d126ff90c6dfcd.tar.xz
blk-core: use pr_warn_ratelimited() in bio_check_ro()
[ Upstream commit 1b0a151c10a6d823f033023b9fdd9af72a89591b ] 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: 57e95e4670d1 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index ebb7a1689b26..6eaf2b0ad7cc 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -490,8 +490,8 @@ static inline void bio_check_ro(struct bio *bio)
if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev)) {
if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
return;
- pr_warn("Trying to write to read-only block-device %pg\n",
- bio->bi_bdev);
+ pr_warn_ratelimited("Trying to write to read-only block-device %pg\n",
+ bio->bi_bdev);
/* Older lvm-tools actually trigger this */
}
}