Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp394730ybk; Wed, 13 May 2020 03:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQdQuaOFcDt1v8gcVrDkH5jRh/oVj+l4arEL5yQ7exZCaS3Di4mgTCJvLXzhTILFQ6+QEw X-Received: by 2002:a05:6402:1c1e:: with SMTP id ck30mr540075edb.154.1589364232556; Wed, 13 May 2020 03:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589364232; cv=none; d=google.com; s=arc-20160816; b=NcAXVl1uHkmFS5E5iYcmLHRTlwueeMXliuUK4OrqE4JdPaSFWKLt+W3/OMGVVYKoj6 kMy1z00rQZmh+eCaNoE7CWqkyWcE93q90mo5z1R286o+AgyM3UdOVKLhPUCtJtKWztzW rbHSK58wui8PFG6ONrJ1YpzB0xnPjU/r8FaO9SWdmdd3cCEnMqpRowP8mC7BB6vkHL8t /dbnWqoqkCyyasx6+dLr3PerN424JBauPq/GZrafdp3gE2zy6iuRB2x84xpEw11+5FtG KTTDx4w+0NBmFDTjuyG0ytNzp4X53EPviQiD9ZYcMsUbAZiENt/X1t1PCbgBD5YulrMH 2SdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mlaqW+jRtZhtDRupps2WRw2+MHaVNMbDvR3Mx5S0lfY=; b=gG67klNsr2A33LyovA8FYraFRoE5vhIQ62RcWfmL4Z/XNU2XAzVb56C4U73BqrhYav 9RJgs1MWIpoF/nKLQZBN5z03kbw13nijK1YaEjNiGkr/4ukVDSmc9iAh8jn8bLyno12M r+T4xneFb1eg+Q99n8cXSveTZ9LkUt74OemUt7LHzMlY/oHNdjh5GNeWSlcWv3ZWG9kX UIS2cQ/eRUWGruGWNUtCHgkrTtv0RLh1BiuUhV2YvUMF2IdKrFxN5UQJ+RDz3tOBBItg POGDlaewbCxtSni9cNMnOoc67MaGcx0oYbMGR4PMo9DQbtgqThthOMBMkeVVZyCoTNfz wF7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yo09FBcc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dx10si964675ejb.496.2020.05.13.03.03.29; Wed, 13 May 2020 03:03:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Yo09FBcc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388598AbgEMKAo (ORCPT + 99 others); Wed, 13 May 2020 06:00:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:52714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387689AbgEMJvm (ORCPT ); Wed, 13 May 2020 05:51:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EB03D206D6; Wed, 13 May 2020 09:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589363501; bh=v7NdYPKBxwZImOHEBfWad5B/TjWWCPo/UVSdqEdgSU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yo09FBccf0ZViA2jCReqZ0QAYQBLkhIs9yIK7UuYvdhQtZu+iDLZk4oxvp00coDBu yqcMfIxD0xPqg1A7+TBqpGTWgCOSn9sW1LSB4BipmMoDxCWX9JQLqn12M+RgFt12O6 rzmgAksD4GaWh4zfu4iWO702r848AJVtGj8PhdUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anton Eidelman , Sagi Grimberg , Keith Busch , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.6 010/118] nvme: fix possible hang when ns scanning fails during error recovery Date: Wed, 13 May 2020 11:43:49 +0200 Message-Id: <20200513094418.563762283@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200513094417.618129545@linuxfoundation.org> References: <20200513094417.618129545@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sagi Grimberg [ Upstream commit 59c7c3caaaf8750df4ec3255082f15eb4e371514 ] When the controller is reconnecting, the host fails I/O and admin commands as the host cannot reach the controller. ns scanning may revalidate namespaces during that period and it is wrong to remove namespaces due to these failures as we may hang (see 205da2434301). One command that may fail is nvme_identify_ns_descs. Since we return success due to having ns identify descriptor list optional, we continue to compare ns identifiers in nvme_revalidate_disk, obviously fail and return -ENODEV to nvme_validate_ns, which will remove the namespace. Exactly what we don't want to happen. Fixes: 22802bf742c2 ("nvme: Namepace identification descriptor list is optional") Tested-by: Anton Eidelman Signed-off-by: Sagi Grimberg Reviewed-by: Keith Busch Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 545e9e5f1b737..84f20369d8467 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1082,7 +1082,7 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid, * Don't treat an error as fatal, as we potentially already * have a NGUID or EUI-64. */ - if (status > 0) + if (status > 0 && !(status & NVME_SC_DNR)) status = 0; goto free_data; } -- 2.20.1