Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp399380pxb; Wed, 18 Aug 2021 05:10:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLy61VHoiSbBMUNbAYbiAvDJOMIunFInDedgvP6NvSEQG94mBuPDGdaxFOLnI2RdKtUIsq X-Received: by 2002:a05:6402:214d:: with SMTP id bq13mr9673526edb.263.1629288632360; Wed, 18 Aug 2021 05:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629288632; cv=none; d=google.com; s=arc-20160816; b=h/C2K12jiML/h2opee80ROjpOVDRB7epJD0gNEGcubVU4bN2VLpVVu0jy5q0/fzteJ z90ZtVdJLm+DsfhI4SN+5OOqDTC6FuqArXFBvxS8yFAzGCwNjwONRfiNPMYVBBqLgJ+Z azzNKl5dTqvIGqORqNOjaXi2EiuxW3hKexsiOc1xUf8LfLuvUGU27Q/45onPVY2tBiOu zFsJiJ4HpvNVsU77Bw0MKJ0gVMeCXh9AJDoOdO071cZEUZwTBcwrifM0MwTJVSp10RXZ Ghr3jAaZTsv1Ms3HCeFk7dE8yhXjCgyEO8DA42aO9IUKtbf4fLnC1kG3SqpmcQRoUYBf b7WQ== 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:dkim-signature; bh=swJyPQGAzH4b6Jy9/zoJjKAUe/5cuKhRUPwssLPQDNI=; b=GDK/Tli4BqWQwsP2r8OwmHQlV/D4PhzvakT14e+9V0eXcN22ejdCfhGECUCoVGYZE9 rFVf4WFDFhPrRS85MGZ6+71y3xvdE6SluqyHQiiZnxf2DAk6azkNaJjCNd+LfiWG+RPh ZZzfv2Pi8n4ibwdDnW9q4EuPfvhkpQOJnKOSxfbnSoXJcYL7sdXEDetOxxjc6OQBcYLd bqG4mqEOPz17/cORz3g0eEfKLJbM7FWU02MQMW9T55uNsATvYNJIuLR2bi7csI5i4iWe 6cP6DyvQEu0JHoYKoUVkIyge8jB23q4rvATYG1usEXERbufip68t7N9CskTzwz8lRGh4 hiqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=fY0cVzRp; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx19si5227439edb.25.2021.08.18.05.10.09; Wed, 18 Aug 2021 05:10:32 -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=@suse.de header.s=susede2_rsa header.b=fY0cVzRp; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236104AbhHRMGT (ORCPT + 99 others); Wed, 18 Aug 2021 08:06:19 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:35652 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235358AbhHRMGI (ORCPT ); Wed, 18 Aug 2021 08:06:08 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2DD8E22031; Wed, 18 Aug 2021 12:05:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1629288333; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=swJyPQGAzH4b6Jy9/zoJjKAUe/5cuKhRUPwssLPQDNI=; b=fY0cVzRp1TgEEVqpu1uqOorozEh1y0bq3L0laRdffvWVXPId4yL39WEC+x/Oeb9CtHqHq0 i5NSjIZelR0x1fXCRyO++ophmnLzrLk1xzDCPG3vRZ5Ep8tPkRQcAVN2hf/HCIY+AmJ84N q5TC+tM4OqeVZQN16tg+AOXZLEAtvQE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1629288333; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=swJyPQGAzH4b6Jy9/zoJjKAUe/5cuKhRUPwssLPQDNI=; b=mWRRoR5npJuDr87GIBuBmboaqbt7VHyqQ2nbrVAp/Pbf++cJzcoCrHuXlqPF5v8sv5cMgB PFqwsKXm7QAfcHBg== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 5557CA3B9C; Wed, 18 Aug 2021 12:05:31 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 17828) id 84E4D518CF7F; Wed, 18 Aug 2021 14:05:31 +0200 (CEST) From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, James Smart , Keith Busch , Ming Lei , Sagi Grimberg , Hannes Reinecke , Wen Xiong , Himanshu Madhani , James Smart , Daniel Wagner Subject: [PATCH v5 3/3] nvme-fc: fix controller reset hang during traffic Date: Wed, 18 Aug 2021 14:05:30 +0200 Message-Id: <20210818120530.130501-4-dwagner@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210818120530.130501-1-dwagner@suse.de> References: <20210818120530.130501-1-dwagner@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart commit fe35ec58f0d3 ("block: update hctx map when use multiple maps") exposed an issue where we may hang trying to wait for queue freeze during I/O. We call blk_mq_update_nr_hw_queues which may attempt to freeze the queue. However we never started queue freeze when starting the reset, which means that we have inflight pending requests that entered the queue that we will not complete once the queue is quiesced. So start a freeze before we quiesce the queue, and unfreeze the queue after we successfully connected the I/O queues (the unfreeze is already present in the code). blk_mq_update_nr_hw_queues will be called only after we are sure that the queue was already frozen. This follows to how the pci driver handles resets. This patch added logic introduced in commit 9f98772ba307 "nvme-rdma: fix controller reset hang during traffic". Signed-off-by: James Smart CC: Sagi Grimberg Tested-by: Daniel Wagner Reviewed-by: Daniel Wagner --- drivers/nvme/host/fc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 3ff783a2e9f7..99dadab2724c 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2974,9 +2974,10 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) return -ENODEV; } blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues); - nvme_unfreeze(&ctrl->ctrl); } + nvme_unfreeze(&ctrl->ctrl); + return 0; out_delete_hw_queues: @@ -3215,6 +3216,9 @@ nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl) ctrl->iocnt = 0; spin_unlock_irqrestore(&ctrl->lock, flags); + if (ctrl->ctrl.queue_count > 1) + nvme_start_freeze(&ctrl->ctrl); + __nvme_fc_abort_outstanding_ios(ctrl, false); /* kill the aens as they are a separate path */ -- 2.29.2