diff --git a/block/blk-core.c b/block/blk-core.c index 01f0782668ce76a3886421d1a251b923d745548b..71546ea13ecc6e816228e29559c6755fdd401cad 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 1d7d5aa737608b2491eff03c11bae1b19ed10db4..47ccd88923d143db4a20fba63955399fec055211 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; + KABI_FILL_HOLE(bool ro_warned) int partno; struct partition_meta_info *info; #ifdef CONFIG_FAIL_MAKE_REQUEST