Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2918879rwb; Mon, 15 Aug 2022 14:03:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR4vzf/HCpR6QjgF2mDhHBibgN1THFAKdooN4msou2WRTV3FPMzhw3g1AzwCtFNBtxCMbAKD X-Received: by 2002:a05:6402:25c6:b0:43b:7797:d953 with SMTP id x6-20020a05640225c600b0043b7797d953mr16025163edb.254.1660597407504; Mon, 15 Aug 2022 14:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597407; cv=none; d=google.com; s=arc-20160816; b=YtMTr65u4D0Sfy9rPW900jLnVfnmaudBLM4cqmfRVXFbnBEwR3PR/XZHbd0ksJ4rxU 7WReuW4Q08E0D/+Bg+2/q6ADNvncfVBYARg9aS6z6UnzOv016pcqpgEGZEyhM8PvFYU+ wA17W8J9ixgX4cBKFU0r9atLPnUU/7pRFgNzbP2R0KAi9Ck8ZV2f6zYbl4Tjmo1x1RU9 2bNOf6vW1ELTK4oXYUAhkwKHsGXYxIV35CZ85II9coDKMZCs7lTC2UYFNXz6YLDVM2SZ rtjb7ifBlKIYn5XFhjBGC18bY9MmMCfCJo02CyRiIhSln3Ut5YU1okMDsp5SDv7uO+E9 L6WA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9aQ3emVCNIyJLB9CRljGZ3yXOEJOnqRyORwYUy9bRt0=; b=Kw36fGDD2bLHMCWEVQ3K3WWMjG8xYlScFgHiOUC01l4LlHG7BMsaio04Ozt48RWWZ+ /OaC7xquMxRTVnYPR6SqI+3vbVTNdfAkJ3UyMeTLA1u+Y6DeQ66NQngKdX3ez4xAQ6kf 8H0rhHpWOxEJR7v6Z74RpRTF9vN/X+yLun8aIaKOaVcTBEnew++9Lhrv3FU3naaeMWFw RW3iowZa9EdB6Plq15HlTCmoMTzU5HxWw1uf78NQHrMiKzRy5wBdvI+HztAOPXWR14jd 2Mgy8A/mqPnRrX4aUZZqjhw27lUek77zkc4c6JppTaYu4bOVxtoHLkg1dnQdYA+Bj+RF gifw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="VmHT/nfT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du4-20020a17090772c400b007277dd43476si9147969ejc.347.2022.08.15.14.03.01; Mon, 15 Aug 2022 14:03:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="VmHT/nfT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245366AbiHOTas (ORCPT + 99 others); Mon, 15 Aug 2022 15:30:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343953AbiHOT0S (ORCPT ); Mon, 15 Aug 2022 15:26:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8856E2A95F; Mon, 15 Aug 2022 11:41:55 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 2685160FB8; Mon, 15 Aug 2022 18:41:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2823C433B5; Mon, 15 Aug 2022 18:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588914; bh=d9k79EkyQ2/BI9EEkP/6956Vb4q7VWRvrkWKgvW8sIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmHT/nfTnaKx1Op5s8xwdmh2iMc1UQef3ojJgFDWtpKiyRM4v6XHcMG+fbMceDTVx qQyA42qmXYnF+PO4EbzlscjF244/uS6ARehaycInHERYPYvcNBnNkfioto9SVfT8Eh rmapXrcZnejGi3dnA6VSCIiMqPV5o0ko1kMHvuzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Granados , Christoph Hellwig , Sagi Grimberg , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 553/779] nvme: catch -ENODEV from nvme_revalidate_zones again Date: Mon, 15 Aug 2022 20:03:17 +0200 Message-Id: <20220815180400.976145763@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-kernel@vger.kernel.org From: Christoph Hellwig [ Upstream commit e06b425bc835ead08b9fd935bf5e47eef473e7a0 ] nvme_revalidate_zones can also return -ENODEV if e.g. zone sizes aren't constant or not a power of two. In that case we should jump to marking the gendisk hidden and only support pass through. Fixes: 602e57c9799c ("nvme: also mark passthrough-only namespaces ready in nvme_update_ns_info") Reported-by: Joel Granados Signed-off-by: Christoph Hellwig Reviewed-by: Joel Granados Reviewed-by: Sagi Grimberg Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index ddaad05ff043..ed2740585c5d 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1914,8 +1914,10 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) if (ns->head->ids.csi == NVME_CSI_ZNS) { ret = nvme_update_zone_info(ns, lbaf); - if (ret) - goto out_unfreeze; + if (ret) { + blk_mq_unfreeze_queue(ns->disk->queue); + goto out; + } } set_disk_ro(ns->disk, (id->nsattr & NVME_NS_ATTR_RO) || @@ -1926,7 +1928,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) if (blk_queue_is_zoned(ns->queue)) { ret = nvme_revalidate_zones(ns); if (ret && !nvme_first_scan(ns->disk)) - return ret; + goto out; } if (nvme_ns_head_multipath(ns->head)) { @@ -1941,9 +1943,9 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) disk_update_readahead(ns->head->disk); blk_mq_unfreeze_queue(ns->head->disk->queue); } - return 0; -out_unfreeze: + ret = 0; +out: /* * If probing fails due an unsupported feature, hide the block device, * but still allow other access. @@ -1953,7 +1955,6 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) set_bit(NVME_NS_READY, &ns->flags); ret = 0; } - blk_mq_unfreeze_queue(ns->disk->queue); return ret; } -- 2.35.1