Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp421174pxb; Wed, 24 Feb 2021 05:58:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMcbONq5sd1bLpo++rB7DTZClEtc1nCZrQZGFtx263as5GeWw7uMY26l65kw7cRd7DFwIY X-Received: by 2002:a17:906:d104:: with SMTP id b4mr13299294ejz.390.1614175089160; Wed, 24 Feb 2021 05:58:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614175089; cv=none; d=google.com; s=arc-20160816; b=XKfEWc3Ea929s6ix0MQlL0UDaa1S1UiDA/7mJpw6y6BEa9I1u47SYx42e5xEkNcyhA feRajKVpa9y3YINAoovJLuMIOvO1RVhQitlsVeE1cH99XKhXfypVugnkXRQ1yDKRwgGB OUp8094/DpIUGBeUR1xb8gpBGJhiN4ze/dKVdo5GlpyIi2gAdcEwwuShZ8XMyecOvftT gUVMJ6U/wz9PKzT+lRTcw2w2Eo07Ut/IwouWbohvRw6PBQi/co3rTS+VMdeEmgaqk/Fy a/bYLUAg0m4c75Odnid45o5/rJIhzAdu7lYhE+EPQqMghycQ4g7QVI12ESCHaYV3gWmF AVIw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gsuNbIHkYrA1ZJEQBdhP7XzzuEmSONvYT1biJyke6DY=; b=DWkduiWDZn7SVuKGpmXXq8w5t8gpRIqx5swR56LRG+KZliV08RAwx1AoTEmTfvtQ8l Vb3hZ9v8cGwz7fASAF9+YWYAVu+fa9aQZz8/3hw6Bu99ppNgKBtFoZB2cfmSraGEucI8 Wa1B2W1TLylBZmVrs+ZMP7PgvUNoCsHjUolvwDeWitPFND2LU0bjM6N3d/b9oCxYqRJc pslX8G4+JvR/6a1tzo7yYK37ZQAVaLKC/wY5ECwnJxNSAbJH/JE8HzGBSeSmpSJGdAV3 0CbDHM4F/KrCnaMH8/Y1z1wqC73FkqH4ccDJp4Ky7l3SWtOVEhm5+W8dm0HKBkaXZZHG 1Txw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eSb3CfAF; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si1246018eju.216.2021.02.24.05.57.43; Wed, 24 Feb 2021 05:58:09 -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=@kernel.org header.s=k20201202 header.b=eSb3CfAF; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238084AbhBXN4a (ORCPT + 99 others); Wed, 24 Feb 2021 08:56:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:58120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234019AbhBXNGT (ORCPT ); Wed, 24 Feb 2021 08:06:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E92CF64F83; Wed, 24 Feb 2021 12:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614171255; bh=bOO24WsPorACp8BnYIE4btxNZGRSmuSQ4QeDoezNLg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eSb3CfAFiOpg76hb12RO+GWmVoBrl2g1K4QSqHZvmi14UDOGBYc4HkWls0OzmSO5K 3KKCaklXaUwG0c02KNqFXMBOnGNTWhc8jY3ho8/xUuSsfiHkjrP0MrduU+Jibl5NQE og7Ux42QpVPkW0v1rMyZt3tUQ1Cui9el9bOgBL4jukvRDdHQgSURLMPKZCAmp4kaiJ fLZ6A3TKZLFALoujZdwPARvOUIdDSUMUxefWhnNdven8AVZ2qKLrzLvvJLP043lcom 3OTH7mwQFFxXsfrlk8p5DX0eaUqTl/lhDmng5gxLiUmX5OmyI0ec17lzOiiEboItdR 7ZfLe6saE4pgA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chao Leng , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 26/40] nvme-core: add cancel tagset helpers Date: Wed, 24 Feb 2021 07:53:26 -0500 Message-Id: <20210224125340.483162-26-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224125340.483162-1-sashal@kernel.org> References: <20210224125340.483162-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 c2cabd77884bf..95d77a17375e1 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 e392d6cd92ced..62e5401865fee 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.27.0