mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-27 13:05:03 +08:00
blk-core: use pr_warn_ratelimited() in bio_check_ro()
[ Upstream commit1b0a151c10
] 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:57e95e4670
("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>
This commit is contained in:
parent
b801487109
commit
fd01115b03
@ -698,7 +698,7 @@ 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_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev)) {
|
||||||
if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
|
if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
|
||||||
return;
|
return;
|
||||||
pr_warn("Trying to write to read-only block-device %pg\n",
|
pr_warn_ratelimited("Trying to write to read-only block-device %pg\n",
|
||||||
bio->bi_bdev);
|
bio->bi_bdev);
|
||||||
/* Older lvm-tools actually trigger this */
|
/* Older lvm-tools actually trigger this */
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user