public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ladislav Michl <oss-lists@triops.cz>
To: linux-block@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH] block: ratelimit warning in bio_check_ro
Date: Wed, 7 Jun 2023 08:28:22 +0200	[thread overview]
Message-ID: <ZIAjht591AEza3c4@lenoch> (raw)

From: Ladislav Michl <ladis@linux-mips.org>

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@linux-mips.org>
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


             reply	other threads:[~2023-06-07  6:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  6:28 Ladislav Michl [this message]
2023-06-07  6:30 ` [PATCH] block: ratelimit warning in bio_check_ro Christoph Hellwig
2023-06-07  7:45   ` Ladislav Michl
2023-08-14 19:56     ` Ladislav Michl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZIAjht591AEza3c4@lenoch \
    --to=oss-lists@triops.cz \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox