Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3087940rwb; Mon, 15 Aug 2022 17:50:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bjUHv2xg8+UjNEzbg4Q3WC5lynUUxJ+wU/tMOom/GLYrCCHvvYk3nvGhnvBcrdsrH+1Iz X-Received: by 2002:a17:907:75d8:b0:730:8bf1:9a1 with SMTP id jl24-20020a17090775d800b007308bf109a1mr11823231ejc.604.1660611006246; Mon, 15 Aug 2022 17:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611006; cv=none; d=google.com; s=arc-20160816; b=GH4W7cEL+oMD+vmYclMPtv6GnUNMov4QUB9O1B7sPuZEFw3Be2X3M2li5QgeGbMzWk at5vzGVIyGmpozMAygZJjP67Chyzl9PVCwIoULg+UER65ZXHEMrIcRvvMnzUvlrTFJHv IDe1sqc8nrecTSY5eyBL5kEMKMZ50v4ms/mBbTrC2AT3W62/v0V0wWOMRtq+rCz31n6P 3fuPsP3Hf62NSq/XpTX8r4dEzQ/DENcbYKTzWduBbx1DrFZKIqWL59k6J15AStzKLLjU g62+nORscXl4T5KyM5K50hbJQ5/9l/Zb2+sAlydyKJSGxUkRR4JxmRVSGvpVIz776aFD IM4A== 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=rkocb/6rMXt3vRscTuHGTxDKixFVQOz0doQSMhdj2N0=; b=La3gDVBCjoDntS36Jey7yEWWi7wB+lbRcDkqz+mCA6XU5TAoVHfW1CmYuk/Chh7ZiH kXuS5JCI01izKGHh1sX0eitglx4e/UspWt+ayHfjsmYaiT+0ZvWXsiDTv3esCExpe9Z/ XOnueG/F1L8ZX90nx1eh1LrXSy7qNXofn/Cub1Zc/59M7ZoF8gGJzZyfVCzvQmkVXAjY vwAyqMnzzgftY1FXgvICXXQmpyOKkh4DZBrgx5sxp0g9P+nLFawsOLSzSr/WZfI9h5bo udsYOGlzC5FFfiXvjmK+ZDTJMpGxNjlS9gNbMzuDIVKZNBYwfbT+W8iKl/15uKLRlSyX 2A6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AcwLGf+j; 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 lz5-20020a170906fb0500b00730c1b3d753si7069074ejb.424.2022.08.15.17.49.40; Mon, 15 Aug 2022 17:50:06 -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=AcwLGf+j; 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 S1348495AbiHOW26 (ORCPT + 99 others); Mon, 15 Aug 2022 18:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345968AbiHOWWI (ORCPT ); Mon, 15 Aug 2022 18:22:08 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29CD26B65D; Mon, 15 Aug 2022 12:43:59 -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 sin.source.kernel.org (Postfix) with ESMTPS id 7052BCE12C4; Mon, 15 Aug 2022 19:43:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DBDEC433D7; Mon, 15 Aug 2022 19:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592635; bh=i8C6Dc6qGwwea9fahLykl8aMjWmt2PqEQCvALcK+vZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AcwLGf+jnK70hsiHQxnptOuheAJs0dIG/iGykdNIbf/CiM+GgHse0u4bv06+RSsg9 s8lqSol9TF5AF8EVGuu/TJUCnM8Y04WRMx6GR8BNTU43hjxs3qY6p0GhYOwk9ttmXh MYNHWdF+giPMPkbtOi3ZUowpvIGKz+khNi4QHKEM= 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.18 0819/1095] nvme: catch -ENODEV from nvme_revalidate_zones again Date: Mon, 15 Aug 2022 20:03:38 +0200 Message-Id: <20220815180503.162495247@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 cf7be9b4f5d3..a58a69999dbc 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1897,8 +1897,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) || @@ -1909,7 +1911,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)) { @@ -1924,9 +1926,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. @@ -1936,7 +1938,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