Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1753358pxb; Wed, 9 Feb 2022 03:53:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwc5YMQsXUAp7bNcjRRepjeCXXnvP8r2qO9y9tLn2vuC9W2WHq193NevHnMs1Y0I773dJI3 X-Received: by 2002:a17:90b:4f4b:: with SMTP id pj11mr2987914pjb.120.1644407613388; Wed, 09 Feb 2022 03:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644407613; cv=none; d=google.com; s=arc-20160816; b=gFw2tx7SiN4g3STCuaD/c48ZAEtFAg+Kerfi0JslDCZysD90TqnFJZ0NjADKsOwpWW dtKJTT0j1GESk9q0qJRrMzDn/037Akf7OBddn1XY5+s4IzbWBuL+i0vnYX75V35hYeua DeBjz56OPeaLUBe0DEOvj+DzD42YuEZTy9xxmTkegG1YbTNGYDWIU0QyDhv2ZpzIbE/V f5UH7nlM+6QOjwESbqWxfDYdN+jMCryxV60J/3t1A2n/FWvwWkO2xEpMRzd56lxEePgn fzTLKBSkJ1q2bNlBiLCOkXA/d3ukJmgoyWHidMeHhI7xMN/2rrjjj2kHRFliKhnQOia/ Hoqw== 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=3W/mfRwv9bbqraI1eC/RDMmVPG1+fX0cGv2GQZz4km0=; b=x7rE/ZR0SZdHJeOupO0Ixh08ApTl0TU50CZ9z2tfm7TC2v9CDazb7inSrWxVc/kvKF iar2KMilpPH5OqOHRAZY+DIcLxNW741V6sYPUfzOHYk8oZJXJd8G9ZW8/qT0BSS9Mup0 2g8xTd4txSiCBeBk+0MH+hYjRJAAZ+emkEsdIKptZTAkfeNrXV1/dq0m2FuRfOlFNtlR AvgQYSymhZV2B3ZJHeOzroFfX66sRBg6qRc3m/SoHgU4tVnoc2BDQK/AYDSKBvYqrpSC dshDYUGwwfIb1srTOy54kmtOybz3vv1LuvGTu53TIeBbbp+3u4FCxqWn4zdxCaehLpMK gFrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L3ntiaDn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p9si5124762pfo.64.2022.02.09.03.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 03:53:33 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-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=@linuxfoundation.org header.s=korg header.b=L3ntiaDn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8E44BE03F77A; Wed, 9 Feb 2022 02:01:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388095AbiBGLm4 (ORCPT + 99 others); Mon, 7 Feb 2022 06:42:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385657AbiBGLcE (ORCPT ); Mon, 7 Feb 2022 06:32:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 876C6C03E903; Mon, 7 Feb 2022 03:31:31 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 4508BB80EBD; Mon, 7 Feb 2022 11:31:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64EE4C340F0; Mon, 7 Feb 2022 11:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233489; bh=A2S0A4K151GBnvxQG7aw3dDzjm91yV1nf3hlhXkSIF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L3ntiaDnFaHb/ArPFfUwQ++YH0jy5aDey17EqgxdDTNd2uhxFHtMwaCRIbTmTV+3R RykrFTeIu5S1wTTy1tLCVXSNTOqPen4pfj0V5QJImkbaHL1SVkblKvfadRz6DKW8e6 9aj/fvcKH29gUQjIY3sJGsA7HN5WBx+/LO+59WEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Uday Shankar , James Smart , Sagi Grimberg , Christoph Hellwig Subject: [PATCH 5.16 029/126] nvme-fabrics: fix state check in nvmf_ctlr_matches_baseopts() Date: Mon, 7 Feb 2022 12:06:00 +0100 Message-Id: <20220207103805.152074287@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103804.053675072@linuxfoundation.org> References: <20220207103804.053675072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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-kernel@vger.kernel.org From: Uday Shankar commit 6a51abdeb259a56d95f13cc67e3a0838bcda0377 upstream. Controller deletion/reset, immediately followed by or concurrent with a reconnect, is hard failing the connect attempt resulting in a complete loss of connectivity to the controller. In the connect request, fabrics looks for an existing controller with the same address components and aborts the connect if a controller already exists and the duplicate connect option isn't set. The match routine filters out controllers that are dead or dying, so they don't interfere with the new connect request. When NVME_CTRL_DELETING_NOIO was added, it missed updating the state filters in the nvmf_ctlr_matches_baseopts() routine. Thus, when in this new state, it's seen as a live controller and fails the connect request. Correct by adding the DELETING_NIO state to the match checks. Fixes: ecca390e8056 ("nvme: fix deadlock in disconnect during scan_work and/or ana_work") Cc: # v5.7+ Signed-off-by: Uday Shankar Reviewed-by: James Smart Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/host/fabrics.h | 1 + 1 file changed, 1 insertion(+) --- a/drivers/nvme/host/fabrics.h +++ b/drivers/nvme/host/fabrics.h @@ -170,6 +170,7 @@ nvmf_ctlr_matches_baseopts(struct nvme_c struct nvmf_ctrl_options *opts) { if (ctrl->state == NVME_CTRL_DELETING || + ctrl->state == NVME_CTRL_DELETING_NOIO || ctrl->state == NVME_CTRL_DEAD || strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) || strcmp(opts->host->nqn, ctrl->opts->host->nqn) ||