block: ratelimit warning in bio_check_ro
PATCH 1/1 block: ratelimit warning in bio_check_ro
From: Ladislav Michl <[email protected]>
Until 57e95e4670d1 ("block: fix and cleanup bio_check_ro") a WARN_ONCE was used to print a warning. Current pr_warn causes log flood, so use pr_warn_ratelimited instead.
Once there adjust message to match the one used in bio_check_eod.
--- block/blk-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-core.c +2 -2
@@ -496,8 +496,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 ("%s: attempt to write to read-only device %pg\n" , + current->comm, bio->bi_bdev);/* Older lvm-tools actually trigger this */ } }
Signature · 1 line
2.32.0
Quoted 6 lines · Ladislav Michl
From: Ladislav Michl <[email protected]>
Until
57e95e4670d1("block: fix and cleanupbio_check_ro") aWARN_ONCEwas used to print a warning. Currentpr_warncauses log flood, so usepr_warn_ratelimitedinstead.
Once there adjust message to match the one used inbio_check_eod.
Do you have a case that hits this? Beause we'd really need to fix it.
Otherwise this looks ok to me.
Hi Christoph,
Quoted 9 lines · Christoph Hellwig
Quoted 6 lines · Ladislav Michl
From: Ladislav Michl <[email protected]>
Until
57e95e4670d1("block: fix and cleanupbio_check_ro") aWARN_ONCEwas used to print a warning. Currentpr_warncauses log flood, so usepr_warn_ratelimitedinstead.
Once there adjust message to match the one used inbio_check_eod.Do you have a case that hits this? Beause we'd really need to fix it.
I hit that while working on customer's embedded board. There's eMMC where boot partitions are locked after upgrade by writing 1 into force_ro sysfs file. Pending writes are triggering this warnign. Of course update scripts was fixed meanwhile and knowing what process triggered warning was quite helpful. So there's nothing to fix, it is just improved diagnostic and returning to (almost) old behaviour.
Quoted 1 line
Otherwise this looks ok to me.
Quoted 13 lines · Ladislav Michl
Hi Christoph,
Quoted 9 lines · Christoph Hellwig
Quoted 6 lines · Ladislav Michl
From: Ladislav Michl <[email protected]>
Until
57e95e4670d1("block: fix and cleanupbio_check_ro") aWARN_ONCEwas used to print a warning. Currentpr_warncauses log flood, so usepr_warn_ratelimitedinstead.
Once there adjust message to match the one used inbio_check_eod.Do you have a case that hits this? Beause we'd really need to fix it.
Quoted 9 lines
I hit that while working on customer's embedded board. There's eMMC where boot partitions are locked after upgrade by writing 1 into
force_rosysfs file. Pending writes are triggering this warnign. Of course update scripts was fixed meanwhile and knowing what process triggered warning was quite helpful. So there's nothing to fix, it is just improved diagnostic and returning to (almost) old behaviour.Quoted 1 line
Otherwise this looks ok to me.
Any more thoughts on that? I do not push on it being mainlined, just sorting patch stack for one of custom boards...
Thanks,
l.