From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA17439FC0 for ; Wed, 15 Nov 2023 20:52:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TC+VkL9a" 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 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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