From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86F7DC2BB3F for ; Wed, 15 Nov 2023 20:52:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233860AbjKOUwq (ORCPT ); Wed, 15 Nov 2023 15:52:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233760AbjKOUwp (ORCPT ); Wed, 15 Nov 2023 15:52:45 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05D098F for ; Wed, 15 Nov 2023 12:52:43 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77A21C4E779; Wed, 15 Nov 2023 20:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700081562; bh=5brI4KZmmlkAoy8nbq7+dgugO7W9DNxJbVq6w/JtvBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TC+VkL9arUsptAbKMw93VYn4jJ/a9Ww9v9NzlRXHi8cmL76A/UzgX7A+iTjkYJ2b9 xudieTohP7/EiQ9w7qShAdHTUpJDQGGfgrAfmROhYc82C9mvr5Ldko/FlfNlCM4hmQ wHA97pn8Jw+31Dy2y2L9zpdrIv0n+lUVFp4mJ2yg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yu Kuai , Ye Bin , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 230/244] blk-core: use pr_warn_ratelimited() in bio_check_ro() Date: Wed, 15 Nov 2023 15:37:02 -0500 Message-ID: <20231115203602.149883573@linuxfoundation.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231115203548.387164783@linuxfoundation.org> References: <20231115203548.387164783@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yu Kuai [ Upstream commit 1b0a151c10a6d823f033023b9fdd9af72a89591b ] If one of the underlying disks of raid or dm is set to read-only, then each io will generate new log, which will cause message storm. This environment is indeed problematic, however we can't make sure our naive custormer won't do this, hence use pr_warn_ratelimited() to prevent message storm in this case. Signed-off-by: Yu Kuai Fixes: 57e95e4670d1 ("block: fix and cleanup bio_check_ro") Signed-off-by: Ye Bin Link: https://lore.kernel.org/r/20231107111247.2157820-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- 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 a3d5306d130d0..3c7d57afa5a3f 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -698,8 +698,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("Trying to write to read-only block-device %pg\n", + bio->bi_bdev); /* Older lvm-tools actually trigger this */ } } -- 2.42.0