[PATCH OLK-5.10 v2 0/2] block: warn once for each partition in bio_check_ro()

Yu Kuai (2): block: warn once for each partition in bio_check_ro() block: fix kabi broken in struct hd_part block/blk-core.c | 5 +++++ include/linux/genhd.h | 1 + 2 files changed, 6 insertions(+) -- 2.39.2

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8HQ3W -------------------------------- If underlying disk of raid/dm is set to read only, then each write will trigger a warn in bio_check_ro(), cause message storm. Fix it by generating such warn only once for each partition. Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- block/blk-core.c | 5 +++++ include/linux/genhd.h | 1 + 2 files changed, 6 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 71d60ec24a8a..3564de78f102 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -713,6 +713,11 @@ static inline bool bio_check_ro(struct bio *bio, struct hd_struct *part) if (op_is_flush(bio->bi_opf) && !bio_sectors(bio)) return false; + + if (part->ro_warned) + return false; + + part->ro_warned = true; pr_warn("Trying to write to read-only block-device %s (partno %d)\n", bio_devname(bio, b), part->partno); /* Older lvm-tools actually trigger this */ diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 1d7d5aa73760..de4ec8798e64 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -69,6 +69,7 @@ struct hd_struct { struct device __dev; struct kobject *holder_dir; bool read_only; + bool ro_warned; int partno; struct partition_meta_info *info; #ifdef CONFIG_FAIL_MAKE_REQUEST -- 2.39.2

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8HQ3W -------------------------------- A new field is added in struct hd_part, fix kabi broken by using KABI_FILL_HOLE. Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- include/linux/genhd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index de4ec8798e64..47ccd88923d1 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -69,7 +69,7 @@ struct hd_struct { struct device __dev; struct kobject *holder_dir; bool read_only; - bool ro_warned; + KABI_FILL_HOLE(bool ro_warned) int partno; struct partition_meta_info *info; #ifdef CONFIG_FAIL_MAKE_REQUEST -- 2.39.2

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3552 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/K... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3552 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/K...
participants (2)
-
patchwork bot
-
Yu Kuai