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 0D288C433F5 for ; Tue, 28 Sep 2021 05:57:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6C86613A0 for ; Tue, 28 Sep 2021 05:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239233AbhI1F7A (ORCPT ); Tue, 28 Sep 2021 01:59:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:49182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239050AbhI1F6T (ORCPT ); Tue, 28 Sep 2021 01:58:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9E4AF611CE; Tue, 28 Sep 2021 05:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632808592; bh=cMFuB0ybmMSGWrQln4bnzMvugoHYR2fdoGypV85s1xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NEqPrS2XJfv0NaDn+V3gYqfI9oWAN79tymxBqv9EVqYCE6wI4SkZ8ffoWryWNAtYG NfIlza9XzNQaSe5RzL1QFLkWwa3fIBWa14Q1c5u6kCwOtnXGBgqSf1fpLjbT8Q4rWa vOpl/m8PmULoSvkNs0nuTLxJNFyzIqUSMXUIUQDHmFQK5cj1P9lD1msZBbJvPHRz9F Mv+ABB62IxMj2/UCrnRRByIdlPjDImYAdSaR6KJ97xsAdhyfy5McDE8b6BEUiDIYWF scPIJgPScsmIqP4fnHsTa3BCi/oZiv6JLFX2tdAXiJoWtCrGnm4ms2Uif12qnGkaUB mMV4koSQn+e/g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Wagner , Ming Lei , Himanshu Madhani , Hannes Reinecke , James Smart , 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 30/40] nvme-fc: update hardware queues before using them Date: Tue, 28 Sep 2021 01:55:14 -0400 Message-Id: <20210928055524.172051-30-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: Daniel Wagner [ Upstream commit 555f66d0f8a38537456acc77043d0e4469fcbe8e ] In case the number of hardware queues changes, we need to update the tagset and the mapping of ctx to hctx first. If we try to create and connect the I/O queues first, this operation will fail (target will reject the connect call due to the wrong number of queues) and hence we bail out of the recreate function. Then we will to try the very same operation again, thus we don't make any progress. Signed-off-by: Daniel Wagner Reviewed-by: Ming Lei Reviewed-by: Himanshu Madhani Reviewed-by: Hannes Reinecke Reviewed-by: James Smart Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/fc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index b08a61ca283f..b5d9a5507de5 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2951,14 +2951,6 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) if (ctrl->ctrl.queue_count == 1) return 0; - ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); - if (ret) - goto out_free_io_queues; - - ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); - if (ret) - goto out_delete_hw_queues; - if (prior_ioq_cnt != nr_io_queues) { dev_info(ctrl->ctrl.device, "reconnect: revising io queue count from %d to %d\n", @@ -2968,6 +2960,14 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) nvme_unfreeze(&ctrl->ctrl); } + ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); + if (ret) + goto out_free_io_queues; + + ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); + if (ret) + goto out_delete_hw_queues; + return 0; out_delete_hw_queues: -- 2.33.0