Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3354366pxf; Mon, 15 Mar 2021 07:50:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaW0Iigspyz0Iig/znU6S/ALwYvKGg0mBxEOuGznuZ7zwOUOICxljr4gkrzYKNVUkI0fLH X-Received: by 2002:a17:906:4d94:: with SMTP id s20mr9105478eju.286.1615819816623; Mon, 15 Mar 2021 07:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615819816; cv=none; d=google.com; s=arc-20160816; b=bnACvWC2SlH0fo29zHx30UDNN7DURkgpp7svifpJo5yvkO2I3ulgv14wvTPu9QEKGd 8iOea8CDN+MK2FD2bVbowPFvFRov7ZTo5F/8FldxRqxcYPbcoV9+vrnDfToiMqTanO1O 44JyD8cKjrdDTVVfORjUYXOvpKGQKFjXGKPpdJyOKhGyrO3zNnF+oCs1n3zpUhaJm0vw nmGHyt6uRfqmHFOcwVto90yF6beJs0wQ8ZP+5Wqkf0HUXC9mwjIl+0UxPOQ0HX2q5t92 WmsQEgp5ZwrxLB1ChhpnyKHaWO24S1zu69pkPG8F3EfIrB85dNryh9JFNsHoMVXQs4WN lsIA== 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=+jLTARPEModLBELaNOflIwV+WLsXtpo6Adfsb+tx1Os=; b=NuO9uklt+U1GMHgPc9/nW9q1hn81zVW289qlJETWwUoNQva0S8lRxPOczZ++ibyJZo SHBVrsf9BRoCT9ufnvtGB7oK/HPiVH7TfiPP0rsESK8eBmSv0y+Of4JJl9mqiQYKEGis qDXtMlN0tZUF/ivO3DjAqq2S7ILGKY41/1xzeVMllKC9rsTCGb6rwotL1mX3dr7C4L3B Vlwd1l1EwDQK1nNfg+XQPsyTDxUu787oux1eAFsvmQ6JkeCnwEITTCK1WNb9bmQk4l9D gi/kO9CT2TaI/nSoinYqfUJTX/QWUQTQhNugujTsst/qkRSWRy7VqDB6uQkB7NFguj4n 0pAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UP3LmbBx; 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 r5si11414746ejr.410.2021.03.15.07.49.53; Mon, 15 Mar 2021 07:50:16 -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=@linuxfoundation.org header.s=korg header.b=UP3LmbBx; 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 S240958AbhCOOsQ (ORCPT + 99 others); Mon, 15 Mar 2021 10:48:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:49646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234377AbhCOODR (ORCPT ); Mon, 15 Mar 2021 10:03:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0192664EEE; Mon, 15 Mar 2021 14:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816997; bh=QBYItGqWLCpcZOlA5tWQb9Srp1lpL2o1nruEPDPfUoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UP3LmbBxmzL/WYa5btt6c1Q48xngOehouCrVjWh8Q5prqURTWlvM8PUeiNNZQrCKG V/r5iSDEDKoMnVksRemEjahR0NMpfd4kRVJnd2yCJ7g8AFblx8pqtaQC7ZhPgVIWNa 8fYfcysxHnEHzkDWuXERWNIIPEAZwUP8IP+yvjbw= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nigel Kirkland , James Smart , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.11 251/306] nvme-fc: fix racing controller reset and create association Date: Mon, 15 Mar 2021 14:55:14 +0100 Message-Id: <20210315135516.133328469@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: James Smart [ Upstream commit f20ef34d71abc1fc56b322aaa251f90f94320140 ] Recent patch to prevent calling __nvme_fc_abort_outstanding_ios in interrupt context results in a possible race condition. A controller reset results in errored io completions, which schedules error work. The change of error work to a work element allows it to fire after the ctrl state transition to NVME_CTRL_CONNECTING, causing any outstanding io (used to initialize the controller) to fail and cause problems for connect_work. Add a state check to only schedule error work if not in the RESETTING state. Fixes: 19fce0470f05 ("nvme-fc: avoid calling _nvme_fc_abort_outstanding_ios from interrupt context") Signed-off-by: Nigel Kirkland Signed-off-by: James Smart Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 5f36cfa8136c..7ec6869b3e5b 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2055,7 +2055,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) nvme_fc_complete_rq(rq); check_error: - if (terminate_assoc) + if (terminate_assoc && ctrl->ctrl.state != NVME_CTRL_RESETTING) queue_work(nvme_reset_wq, &ctrl->ioerr_work); } -- 2.30.1