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 870ACC61DA4 for ; Fri, 3 Feb 2023 10:30:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233674AbjBCKaz (ORCPT ); Fri, 3 Feb 2023 05:30:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233683AbjBCKaY (ORCPT ); Fri, 3 Feb 2023 05:30:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9CB09E9F4 for ; Fri, 3 Feb 2023 02:29:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8EA4EB82A64 for ; Fri, 3 Feb 2023 10:29:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCEA7C433D2; Fri, 3 Feb 2023 10:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675420171; bh=T+eResxZDtehth01YiU3FEiesZvEDbevbxCTCsKkFB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i2z39XbzWWBsP3+NIMLsPXoCtThj5X7ld4GKoDLonCN7y2+ENnqPcITij0F2jIt8B ptmIQEKdwDs1OqpMzaEGSag4XH1wiq6Pu9sJzOZzf81afxHdwzuIYUZznKcJUzjC4m /arBG9wPLWye6hq04VWqp1LUqO39D8piA6fUsNRs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christoph Hellwig , Chaitanya Kulkarni , Johannes Thumshirn , Jens Axboe , Fedor Pchelkin Subject: [PATCH 5.4 104/134] block: fix and cleanup bio_check_ro Date: Fri, 3 Feb 2023 11:13:29 +0100 Message-Id: <20230203101028.515275043@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230203101023.832083974@linuxfoundation.org> References: <20230203101023.832083974@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christoph Hellwig commit 57e95e4670d1126c103305bcf34a9442f49f6d6a upstream. Don't use a WARN_ON when printing a potentially user triggered condition. Also don't print the partno when the block device name already includes it, and use the %pg specifier to simplify printing the block device name. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn Link: https://lore.kernel.org/r/20220304180105.409765-2-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Fedor Pchelkin Signed-off-by: Greg Kroah-Hartman --- block/blk-core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/block/blk-core.c +++ b/block/blk-core.c @@ -793,10 +793,7 @@ static inline bool bio_check_ro(struct b if (op_is_flush(bio->bi_opf) && !bio_sectors(bio)) return false; - - WARN_ONCE(1, - "generic_make_request: Trying to write " - "to read-only block-device %s (partno %d)\n", + pr_warn("Trying to write to read-only block-device %s (partno %d)\n", bio_devname(bio, b), part->partno); /* Older lvm-tools actually trigger this */ return false;