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 611D81FB9 for ; Fri, 3 Feb 2023 10:29:31 +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 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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;