Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1588544pxb; Tue, 8 Feb 2022 23:16:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWSl0osTrp9uULK9iXZJnFBsvTJdClzpyaz1s9CohwsWqP+uZzS5zuNYdS4t944Hp875yw X-Received: by 2002:a17:906:60d5:: with SMTP id f21mr756335ejk.482.1644391017790; Tue, 08 Feb 2022 23:16:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644391017; cv=none; d=google.com; s=arc-20160816; b=Qrw/EswdwFm/IVCQl209sccRu6zRYMSLLPANAalUOT5VqN/0ah1EPAlMwgDzkWQpY1 d34e2o6qkBr60FEaPhPmZLmp5mVvx+L1RHF1PyV3hmRCzeRg15JGoFAtZmlCNkdDQ92A ylumfGRj+WrUoyo8j0DQVfcWwXQ0govbb1VPprcQU+qAIRRs3YGc5roMVDXQMWshzp3/ ODXMce4dlIZbg8KXUGvxX9K2MAYBDCaKfOzknTMgtC4o+yhxaGEx3b1G0qCJLW7kaCe4 a8iy6EZUd60vHvErzywY+spAR5EqwI2rcuH7PVyq86P49rFs17Mbpv3KFgTTgO1HQGHo M4KQ== 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=dIttpyf6pb/ekuGUhs8UiUVnWiOgyYUufhAksBf7nhg=; b=IEB63Dsq3W26gM08Ms6C5CHoIf6UTWtryN54GAx/JUF3cNECpYot5DqH2C1gMV1Mtj TfFTQFeeVkOWUuJo1jrmh0W9qN1OAHCeCI1h5/+UkfmU4GkRzDiBjQHGRtAIJJrrxSNG tahsmO+ldvcOzBJqYZRL3Qv0YvZqt5zgYt6dTR0sLz8slGda6CsJFyp30PohsnjVro8v 74oEbZAEj5RDekUNP+JCFXiVacBfVMvjtB3kp/adj9aP8Hzzt+It+Md5hQIYqtg+Btr2 uCvp2vp23zV1inMGv8cWRnqByYob+TjA7BNZUq/fQ54XUsAIDLXRlAKJ4g9eXqBEtQSX 8GTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bqb4agpg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pv18si8859463ejb.976.2022.02.08.23.16.33; Tue, 08 Feb 2022 23:16:57 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=bqb4agpg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356140AbiBGLho (ORCPT + 99 others); Mon, 7 Feb 2022 06:37:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384228AbiBGL0A (ORCPT ); Mon, 7 Feb 2022 06:26:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82714C03FECF; Mon, 7 Feb 2022 03:25:35 -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 A68CCB811BE; Mon, 7 Feb 2022 11:25:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3AB1C340F0; Mon, 7 Feb 2022 11:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233130; bh=RvfjgcB8o1T/+ITst3mAWwtUq/8YKRmzvA/v0luQ6P4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqb4agpgUY/0kRLNTnMXskKyI16z9DyyRdujcRzbNPdQWccpcRDCQZdxvX72KXI1B T4Bxrm88ThQ+qe3WKYs0Fyf4YI/t0zMhtssFHHRZxuXcY+MyiHHixs4hNPvlBDG3LM 9JgQIUVd9QKg6YmC2TWwQYthYTBQdvEkgJzZmghg= 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.15 026/110] nvme-fabrics: fix state check in nvmf_ctlr_matches_baseopts() Date: Mon, 7 Feb 2022 12:05:59 +0100 Message-Id: <20220207103803.132352091@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103802.280120990@linuxfoundation.org> References: <20220207103802.280120990@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=-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: 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 @@ -169,6 +169,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) ||