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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A383C83011 for ; Sun, 29 Nov 2020 18:21:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E099207FF for ; Sun, 29 Nov 2020 18:21:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="VhMuTeEi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728075AbgK2SU4 (ORCPT ); Sun, 29 Nov 2020 13:20:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726470AbgK2SUo (ORCPT ); Sun, 29 Nov 2020 13:20:44 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1363C0613D4; Sun, 29 Nov 2020 10:20:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=EefFTETwdjTT2tc3Kw8m+h2v6iqXbIBFBB9JSH+56hw=; b=VhMuTeEiiHBfSw5NdViDL8pIQr 9XMfTGxzE7EnRGvgfYGgWYUd3SCyDJV5ANGHvXRV04PgLjsXbYj2iHd02HVI2HqIyBAT9JLTe1t9f +2oJdvttHYxKfaFQIukm/IdW2FZ6u3m5hI2JQ5TvrF0e3Tj1LR0G0AOJNg22ZbDbs+EfOpbRjYdX+ FgSpC9vHtZZJw43RiPa/scGhW29vvo4bbDsh7oKnDYX9DojEX7la2eQe637f45Iwlq3ThoXPusS5u XdgP16IwMB4q170Qtgwc90cLhYb9ixdGM4UUEaeckoOBvGRBAvWCqPaV1T1XgMyXVVknzbf30aGTs NIy2OjVg==; Received: from [2001:4bb8:18c:1dd6:f89e:6884:c966:3d6c] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjRIU-00078D-8U; Sun, 29 Nov 2020 18:19:43 +0000 From: Christoph Hellwig To: Jens Axboe Cc: "Martin K . Petersen" , Oleksii Kurochko , Sagi Grimberg , Mike Snitzer , Ilya Dryomov , Dongsheng Yang , ceph-devel@vger.kernel.org, dm-devel@redhat.com, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Subject: [PATCH 3/4] nvme: allow revalidate to set a namespace read-only Date: Sun, 29 Nov 2020 19:19:25 +0100 Message-Id: <20201129181926.897775-4-hch@lst.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201129181926.897775-1-hch@lst.de> References: <20201129181926.897775-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Unconditionally call set_disk_ro now that it only updates the hardware state. This allows to properly set up the Linux devices read-only when the controller turns a previously writable namespace read-only. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index bc89e8659c403f..2442f43a1a5624 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2047,8 +2047,7 @@ static void nvme_update_disk_info(struct gendisk *disk, nvme_config_discard(disk, ns); nvme_config_write_zeroes(disk, ns); - if (id->nsattr & NVME_NS_ATTR_RO) - set_disk_ro(disk, true); + set_disk_ro(disk, id->nsattr & NVME_NS_ATTR_RO); } static inline bool nvme_first_scan(struct gendisk *disk) -- 2.29.2 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 X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8E2AC64E8A for ; Sun, 29 Nov 2020 18:19:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49BDC20731 for ; Sun, 29 Nov 2020 18:19:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Vl8cuXn0"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="VhMuTeEi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49BDC20731 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=P6mUc+xOhUqJ9sbfUcj2PE1ke2QkinaKnc3obVL0hfo=; b=Vl8cuXn03guvslNBt8EnMZwuP ddc8GRfmVS6o9s+RI3wUeOff4pMYLcEMTqPo617qEDEU7CuBw4XOxGk6JuyZ0Io/Q95SVogW8hJWi qZE9CY1nKKejbGX/pscmWldPm6EzMBI9YY/y6qbg5QKlF1GM31aewTMqwJloxU6KK/PM3MQ7w18l8 ZyA9YM4fvrYCTBUwlM+zkuyr9K4oF083cPFYdkSe+mB+25lJcfNrJLhsmhQ6rac98EzsVUVGYeKFj 7dmHnpDZRP/HkPRNV1ih9vd6lFB1zTAZtfrXJ7/342SIUfTMn86/8WNfSKVR5aa+blHBZ8p1SRQVT HX/4i9f1g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjRId-0007T3-01; Sun, 29 Nov 2020 18:19:51 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjRIW-0007Rw-RJ for linux-nvme@merlin.infradead.org; Sun, 29 Nov 2020 18:19:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=EefFTETwdjTT2tc3Kw8m+h2v6iqXbIBFBB9JSH+56hw=; b=VhMuTeEiiHBfSw5NdViDL8pIQr 9XMfTGxzE7EnRGvgfYGgWYUd3SCyDJV5ANGHvXRV04PgLjsXbYj2iHd02HVI2HqIyBAT9JLTe1t9f +2oJdvttHYxKfaFQIukm/IdW2FZ6u3m5hI2JQ5TvrF0e3Tj1LR0G0AOJNg22ZbDbs+EfOpbRjYdX+ FgSpC9vHtZZJw43RiPa/scGhW29vvo4bbDsh7oKnDYX9DojEX7la2eQe637f45Iwlq3ThoXPusS5u XdgP16IwMB4q170Qtgwc90cLhYb9ixdGM4UUEaeckoOBvGRBAvWCqPaV1T1XgMyXVVknzbf30aGTs NIy2OjVg==; Received: from [2001:4bb8:18c:1dd6:f89e:6884:c966:3d6c] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjRIU-00078D-8U; Sun, 29 Nov 2020 18:19:43 +0000 From: Christoph Hellwig To: Jens Axboe Subject: [PATCH 3/4] nvme: allow revalidate to set a namespace read-only Date: Sun, 29 Nov 2020 19:19:25 +0100 Message-Id: <20201129181926.897775-4-hch@lst.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201129181926.897775-1-hch@lst.de> References: <20201129181926.897775-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sagi Grimberg , Mike Snitzer , Oleksii Kurochko , Dongsheng Yang , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-nvme@lists.infradead.org, "Martin K . Petersen" , Ilya Dryomov , ceph-devel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org Unconditionally call set_disk_ro now that it only updates the hardware state. This allows to properly set up the Linux devices read-only when the controller turns a previously writable namespace read-only. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index bc89e8659c403f..2442f43a1a5624 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2047,8 +2047,7 @@ static void nvme_update_disk_info(struct gendisk *disk, nvme_config_discard(disk, ns); nvme_config_write_zeroes(disk, ns); - if (id->nsattr & NVME_NS_ATTR_RO) - set_disk_ro(disk, true); + set_disk_ro(disk, id->nsattr & NVME_NS_ATTR_RO); } static inline bool nvme_first_scan(struct gendisk *disk) -- 2.29.2 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme 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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95B13C3E8C5 for ; Sun, 29 Nov 2020 18:42:12 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8056020771 for ; Sun, 29 Nov 2020 18:42:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8056020771 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-187-KnlhdRT8P96LAcy-MbInDA-1; Sun, 29 Nov 2020 13:42:08 -0500 X-MC-Unique: KnlhdRT8P96LAcy-MbInDA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6563D1823DD5; Sun, 29 Nov 2020 18:42:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2519C5D9D2; Sun, 29 Nov 2020 18:42:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 07A204A7C6; Sun, 29 Nov 2020 18:41:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ATIfvBk029788 for ; Sun, 29 Nov 2020 13:41:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2DDC92166B2A; Sun, 29 Nov 2020 18:41:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 293332166B28 for ; Sun, 29 Nov 2020 18:41:53 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 194F48007DF for ; Sun, 29 Nov 2020 18:41:53 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-AWVwV_KQPCK5x_8cBrB4Zw-1; Sun, 29 Nov 2020 13:41:49 -0500 X-MC-Unique: AWVwV_KQPCK5x_8cBrB4Zw-1 Received: from [2001:4bb8:18c:1dd6:f89e:6884:c966:3d6c] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjRIU-00078D-8U; Sun, 29 Nov 2020 18:19:43 +0000 From: Christoph Hellwig To: Jens Axboe Date: Sun, 29 Nov 2020 19:19:25 +0100 Message-Id: <20201129181926.897775-4-hch@lst.de> In-Reply-To: <20201129181926.897775-1-hch@lst.de> References: <20201129181926.897775-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: dm-devel@redhat.com Cc: Sagi Grimberg , Mike Snitzer , Oleksii Kurochko , Dongsheng Yang , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-nvme@lists.infradead.org, "Martin K . Petersen" , Ilya Dryomov , ceph-devel@vger.kernel.org Subject: [dm-devel] [PATCH 3/4] nvme: allow revalidate to set a namespace read-only X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Unconditionally call set_disk_ro now that it only updates the hardware state. This allows to properly set up the Linux devices read-only when the controller turns a previously writable namespace read-only. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index bc89e8659c403f..2442f43a1a5624 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2047,8 +2047,7 @@ static void nvme_update_disk_info(struct gendisk *disk, nvme_config_discard(disk, ns); nvme_config_write_zeroes(disk, ns); - if (id->nsattr & NVME_NS_ATTR_RO) - set_disk_ro(disk, true); + set_disk_ro(disk, id->nsattr & NVME_NS_ATTR_RO); } static inline bool nvme_first_scan(struct gendisk *disk) -- 2.29.2 -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel