Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1977334pxb; Fri, 5 Mar 2021 04:36:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKbzHjFRPqAPnl6PjTQ0XTjZHwaMe2N95rV8L5jpBL5OXG9U0Hp3agonNliJtjC493TlvN X-Received: by 2002:a17:906:3b47:: with SMTP id h7mr1997748ejf.377.1614947802741; Fri, 05 Mar 2021 04:36:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947802; cv=none; d=google.com; s=arc-20160816; b=HVKbCIQJOQH3ATPZhp7Dd7Bt+tDU/zmPMUpVmLmmWAuLFMllmDu0Ojq8isfBBnhN0E Rt3uIZM/9sGwISYeqraj/l/XCv/0m3ZYhOdtb4b+pM8BZqfLodMusA5nqV5sIOv0vheJ ZY8OOpjiNWZABBRCVjU4+15Q3W16b1kMSTw4/osnZNKD6I0kXsdSq9Fuk3+JPOtVMgHG 0RAt2zqfzzRA79UHAHCopDNOETQko0iGFKrH+r48bd2bfjJWj71DoZ0k60Xi6WOU7FQA Iuk3HiE37JSYUK4wF5rpo2QIcajH/uJ+BJc4I1UtEBwM7OVAZYen30X2ZsEeeKZyEEBI 1TXg== 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=OYzojsIZh1bCCVaYXjXwdjmTmfy6B2Fw+BspiKMEpzQ=; b=IFqeoDT5bnd3MkYLihPMXwZL+1fmVhQtvi4yny0/9Bd+5pAp5WuGOuVI2ALnpsiuD4 Kyw7vA+HLV/vxuq2gGtVLHha2SmEaF3FBywK4nr7kC82O77b97h7avBJ6Vr4WxjNQNpq MpHBNFKYu+Qnrsv5It/YPRmYB/epAZe+mKZ+5DwxGV50z+iyNI1PATgnZfS8sx0uH2OY AmObfPPwBCA+lopOKd8n4qicySj8G8f6TNM3f0tjHgGQxTvB8KqxuavJkZy4qQdCSTi7 P5T+0JijW9E1IaKSASm1fMFROvKJ5MIULB7cS0wuRLkKgRXXFFgcf2MHP2BMJAgAXA9Z a6nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uroFL16d; 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 r4si1724377edc.380.2021.03.05.04.36.18; Fri, 05 Mar 2021 04:36:42 -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=uroFL16d; 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 S231153AbhCEMfZ (ORCPT + 99 others); Fri, 5 Mar 2021 07:35:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:46566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbhCEMew (ORCPT ); Fri, 5 Mar 2021 07:34:52 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7133365012; Fri, 5 Mar 2021 12:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947692; bh=Q+5gNeLrhRn7GNRLYP+pUJqul2WSxJZ7pCig/dvbrCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uroFL16dzEaA11u2FSH+PxIH1eIGV/JQYePkQ8HIYg19WB+CVtM5Z5yQjPy0OxwUR 1DQRaLeef4w0ZIsqhseortWGXMqeehid3K+VHdDl+Z7OkHsPadVPhgYgSUi0owtULA yCZxU88APj+MqeygDLoRhpBQH+8NzAaBLrFnomnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.4 49/72] nvme-core: add cancel tagset helpers Date: Fri, 5 Mar 2021 13:21:51 +0100 Message-Id: <20210305120859.733632005@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120857.341630346@linuxfoundation.org> References: <20210305120857.341630346@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: Chao Leng [ Upstream commit 2547906982e2e6a0d42f8957f55af5bb51a7e55f ] Add nvme_cancel_tagset and nvme_cancel_admin_tagset for tear down and reconnection error handling. Signed-off-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 20 ++++++++++++++++++++ drivers/nvme/host/nvme.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index c2cabd77884b..95d77a17375e 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -317,6 +317,26 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) } EXPORT_SYMBOL_GPL(nvme_cancel_request); +void nvme_cancel_tagset(struct nvme_ctrl *ctrl) +{ + if (ctrl->tagset) { + blk_mq_tagset_busy_iter(ctrl->tagset, + nvme_cancel_request, ctrl); + blk_mq_tagset_wait_completed_request(ctrl->tagset); + } +} +EXPORT_SYMBOL_GPL(nvme_cancel_tagset); + +void nvme_cancel_admin_tagset(struct nvme_ctrl *ctrl) +{ + if (ctrl->admin_tagset) { + blk_mq_tagset_busy_iter(ctrl->admin_tagset, + nvme_cancel_request, ctrl); + blk_mq_tagset_wait_completed_request(ctrl->admin_tagset); + } +} +EXPORT_SYMBOL_GPL(nvme_cancel_admin_tagset); + bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, enum nvme_ctrl_state new_state) { diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index e392d6cd92ce..62e5401865fe 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -468,6 +468,8 @@ static inline void nvme_put_ctrl(struct nvme_ctrl *ctrl) void nvme_complete_rq(struct request *req); bool nvme_cancel_request(struct request *req, void *data, bool reserved); +void nvme_cancel_tagset(struct nvme_ctrl *ctrl); +void nvme_cancel_admin_tagset(struct nvme_ctrl *ctrl); bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, enum nvme_ctrl_state new_state); bool nvme_wait_reset(struct nvme_ctrl *ctrl); -- 2.30.1