From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F82EC433EF for ; Tue, 28 Sep 2021 05:57:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 525BB6137E for ; Tue, 28 Sep 2021 05:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239362AbhI1F7F (ORCPT ); Tue, 28 Sep 2021 01:59:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:49184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239120AbhI1F6T (ORCPT ); Tue, 28 Sep 2021 01:58:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 213A960E9B; Tue, 28 Sep 2021 05:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632808593; bh=bv3j4qWxI/q1Epfa4Ktu6EU9MHe7FfcLHo+BUZ/vtl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qA55nO5NKxX5lKEGAHXGymikLHff7g/5BewjCRC9eu9jGEMUD94UpwIxzDQezc3in c/y8bojGTo4ys+00MBu40XUnrVWj1dpsPLLfQ1j3vPob+1oIjzmIEjAatMbIbffkru MkOMk1/CcJc8KOafGpXePT/nHSuW6cBSfnSv+cPIqjyBxVebhQYtldxN4Rx5bYd+i7 c6YrtSJkq+6u/uJWhU6trwZ10EibVcks4WqCZCeilTA5vvdyMYYhOJbDMCWEbROOqo IZ2kjQhGm3yD3LCsjJ9XzF8Pto++QCtgJQ2kKvM2bKKNOwN9oVzww3d7qGjMVx/Dxr 1ryi4vegttBaQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: James Smart , Daniel Wagner , Himanshu Madhani , Hannes Reinecke , Christoph Hellwig , Sasha Levin , james.smart@broadcom.com, kbusch@kernel.org, axboe@fb.com, Christoph@vger.kernel.org, sagi@grimberg.me, linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.14 31/40] nvme-fc: avoid race between time out and tear down Date: Tue, 28 Sep 2021 01:55:15 -0400 Message-Id: <20210928055524.172051-31-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210928055524.172051-1-sashal@kernel.org> References: <20210928055524.172051-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: James Smart [ Upstream commit e5445dae29d25d7b03e0a10d3d4277a1d0c8119b ] To avoid race between time out and tear down, in tear down process, first we quiesce the queue, and then delete the timer and cancel the time out work for the queue. This patch merges the admin and io sync ops into the queue teardown logic as shown in the RDMA patch 3017013dcc "nvme-rdma: avoid race between time out and tear down". There is no teardown_lock in nvme-fc. Signed-off-by: James Smart Tested-by: Daniel Wagner Reviewed-by: Himanshu Madhani Reviewed-by: Hannes Reinecke Reviewed-by: Daniel Wagner Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/fc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index b5d9a5507de5..6ebe68396712 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2487,6 +2487,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) */ if (ctrl->ctrl.queue_count > 1) { nvme_stop_queues(&ctrl->ctrl); + nvme_sync_io_queues(&ctrl->ctrl); blk_mq_tagset_busy_iter(&ctrl->tag_set, nvme_fc_terminate_exchange, &ctrl->ctrl); blk_mq_tagset_wait_completed_request(&ctrl->tag_set); @@ -2510,6 +2511,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) * clean up the admin queue. Same thing as above. */ blk_mq_quiesce_queue(ctrl->ctrl.admin_q); + blk_sync_queue(ctrl->ctrl.admin_q); blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, nvme_fc_terminate_exchange, &ctrl->ctrl); blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set); -- 2.33.0