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 3750AC433F5 for ; Fri, 8 Oct 2021 11:34:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 257DE61507 for ; Fri, 8 Oct 2021 11:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242597AbhJHLfx (ORCPT ); Fri, 8 Oct 2021 07:35:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:59714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240628AbhJHLdF (ORCPT ); Fri, 8 Oct 2021 07:33:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 70CD961039; Fri, 8 Oct 2021 11:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633692662; bh=LaPhhaG2mgWAOD536dC8UsWFYqdgZk4J9qczTJSWNj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jMmxqHKpbiN0jL+eyz6i6k2Ota7eGrSscM9Xpaz82Pdlu36QuspDt7EP59jFxTo+V 76KV3RMM4Vl0OUY8J51uhNA2391FQ+LlF39IPlthewFEJamibAw8e7Pl6WKYa2vFgb cRLY8hofu0muzknFHehHVSjm6kanZYBTj5vszD7E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Smart , Daniel Wagner , Himanshu Madhani , Hannes Reinecke , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.10 18/29] nvme-fc: avoid race between time out and tear down Date: Fri, 8 Oct 2021 13:28:05 +0200 Message-Id: <20211008112717.561928276@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211008112716.914501436@linuxfoundation.org> References: <20211008112716.914501436@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: 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 86c6862e71a1..906cab35afe7 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2486,6 +2486,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); @@ -2509,6 +2510,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