Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2262125pxm; Fri, 4 Mar 2022 12:35:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLSp4+fUvx6jLQVLNgIhWFwGEdDJSJnsZ+c6eQR4Ipga52KtwUoBXmKLEiRVYsMNPRur0V X-Received: by 2002:a17:902:930b:b0:14d:b0c0:1f71 with SMTP id bc11-20020a170902930b00b0014db0c01f71mr110980plb.113.1646426120436; Fri, 04 Mar 2022 12:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646426120; cv=none; d=google.com; s=arc-20160816; b=qfhw6sTef2MiYeMeOfo4+Rd/CDVApdbGuCIvVJ/G3NXOIDPND5+SSLzSESDxVno1zT 73rYxd+pp1oJM7F7DkDD/0eROsncOQfHXhoc7ZJ1zJFjKJbRk2bVog7tkINANdG9Y4mE w4CfTQNFzpZ8/OUp1aSc5jpamS0MXyJMlsczq4y9wzj9jeLG+L/F6rDqcKgOi3aUFAmE p/7zjmqlszKi+Nb2btKfQdJ7Pv1mTxnyUUNHMFZozk7ZIqnYvkfiAZoFmjXT1Ho0E04M bXDipnu+GJ0jM3QnUd+KQU8AD4S9zFh2pdoPAgeKch62L/3E7zQ2My5ZLuOCh2g9IcNw 8F3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vjzfcuVeqJ5gslcqLmqRcao85OHrZZrw3DMsoQUqsYs=; b=tO5MevGulzeWgSm1JpF/XLOm+ShEipzFDCEhEvUmhprCKuFRPCp+np78a8BemE6Gca rKQrysxsfcA2jizyk7Of7T+rJ2Nl4fUj7ZRr1f8QIa1iLEu0tFNfpYRT8tqxOMR3RxBN E3uFy5vg5GdJWOaUuW9PfFp3LzKTO1B+OmxTc1Q5gwUAJKQjpapxuL0MsJdOmJh7UKCb I3EQMPmhm8QELoUShikxr6wcdbUicfeW+NUjm6AMz22SgRs3Q31hU8IeDphGnz63AVmX 8GqsqBaGYW430MBzbxJOU7G6dMSToFU8PdWPZSZtU0MtSujY9A38KcQU05jhfL7wLLxP GzkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BiKgnhAm; spf=softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e19-20020a63e013000000b00362a575c68csi5513698pgh.795.2022.03.04.12.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 12:35:20 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BiKgnhAm; spf=softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B2D522B953; Fri, 4 Mar 2022 11:40:04 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241433AbiCDSCF (ORCPT + 99 others); Fri, 4 Mar 2022 13:02:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241430AbiCDSCB (ORCPT ); Fri, 4 Mar 2022 13:02:01 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC5DF1BD9BA; Fri, 4 Mar 2022 10:01:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=vjzfcuVeqJ5gslcqLmqRcao85OHrZZrw3DMsoQUqsYs=; b=BiKgnhAmpHPz87EcWAzhrmMGp6 JaGZlUMx1zQyrrO53wL2F8YQFToLKhXQl4HjSz2jIgTActUlh7rpAh3BdWhSXI/+4vtYujk7Jn0f4 pzQ4BPjJxSPVLHJVWEzPcl4eu1PlbGAgAgwl/cCFF1TxLVoAKXFkjyUjSU5J1oUyIG9M2g+AfStNA r0ZK3Z/5osrm7jlU9061/F5XSpxy0G39YAXq+7yrRuJ0lZxSeIjfTQedaRT/liapUdpbjZW6JERr1 DatQvFGwUVbQQH9EWGTI5vrTMCVHXEW8lAaao0PKa20ksSwa/e751hFgsK3pWqIr8wMJLQh0xXppG NlXju7tg==; Received: from [2001:4bb8:180:5296:cded:8d4b:ace6:f3c] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQCEn-00BUhb-V7; Fri, 04 Mar 2022 18:01:10 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , "Theodore Ts'o" , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-ext4@vger.kernel.org Subject: [PATCH 01/10] block: fix and cleanup bio_check_ro Date: Fri, 4 Mar 2022 19:00:56 +0100 Message-Id: <20220304180105.409765-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220304180105.409765-1-hch@lst.de> References: <20220304180105.409765-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- block/blk-core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 94bf37f8e61d2..34e1b7fdb7c89 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -580,14 +580,10 @@ late_initcall(fail_make_request_debugfs); static inline bool bio_check_ro(struct bio *bio) { if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev)) { - char b[BDEVNAME_SIZE]; - if (op_is_flush(bio->bi_opf) && !bio_sectors(bio)) return false; - - WARN_ONCE(1, - "Trying to write to read-only block-device %s (partno %d)\n", - bio_devname(bio, b), bio->bi_bdev->bd_partno); + pr_warn("Trying to write to read-only block-device %pg\n", + bio->bi_bdev); /* Older lvm-tools actually trigger this */ return false; } -- 2.30.2