[PATCH] block: ratelimit warning in bio_check_ro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ladislav Michl <ladis@xxxxxxxxxxxxxx>

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.

Signed-off-by: Ladislav Michl <ladis@xxxxxxxxxxxxxx>
Fixes: 57e95e4670d1 ("block: fix and cleanup bio_check_ro")
---
 block/blk-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 1da77e7d6289..fbd9f4102703 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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 */
 	}
 }
-- 
2.32.0




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux