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 91A74C43217 for ; Tue, 28 Sep 2021 05:59:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 865D26113E for ; Tue, 28 Sep 2021 05:59:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239713AbhI1GBX (ORCPT ); Tue, 28 Sep 2021 02:01:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:49572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239187AbhI1F7c (ORCPT ); Tue, 28 Sep 2021 01:59:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9A8886136A; Tue, 28 Sep 2021 05:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632808618; bh=QzJLtmy/dBqYkwtm+nx3JK5csRcCgkF9+xbvX4U8p8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a4cBv9EnWG0+wzHo5xARbxiFqHiVci1y9BfpmAEebcSyJKNfHiSgtMNwV35CX9cRO CtAe4U3NIXIf5iQB38nTJTSqEh385l9dX6LEhi+px8TRUBbIKy8VAmvJWDcvw3Zwys EFooRzSIsx/ZgW1yuPlZB06G/HdmtNT19xh3fh/hn8sC6MOdYwAZlJxiHgJN3nsKhe EyMksUIL8ReDo4uUOPFg9Ze77njdqvTLhl/fJq8zsJmZN9CEd6lo+J3VT/jhJ0/BSV AqcxVj7uFV29aR1c3mPzXP3GsORU/OzY75oH5Qu08Xrk7LBbFDWcoA3efFPTgic1z+ KiNXeM7iXt+ag== 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.10 17/23] nvme-fc: update hardware queues before using them Date: Tue, 28 Sep 2021 01:56:38 -0400 Message-Id: <20210928055645.172544-17-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210928055645.172544-1-sashal@kernel.org> References: <20210928055645.172544-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: stable@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 a0bcec33b020..86c6862e71a1 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2952,14 +2952,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", @@ -2969,6 +2961,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