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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CD36C001B0 for ; Sun, 13 Aug 2023 14:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230204AbjHMOcZ (ORCPT ); Sun, 13 Aug 2023 10:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbjHMOcZ (ORCPT ); Sun, 13 Aug 2023 10:32:25 -0400 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB8E10FC for ; Sun, 13 Aug 2023 07:32:27 -0700 (PDT) Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2b9cb0bb04bso8539071fa.0 for ; Sun, 13 Aug 2023 07:32:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691937145; x=1692541945; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zCCJuLWxlzwZK4lPpl9OOBdDL3u1368YHPb0g0HV9fw=; b=J15vgrJtrdsuXwXe8EEQHWBVEY4rTi3dOfZQoAPeB1wgM3i+K0PYtcGVj4UYOMVYlu yay4vRyNoYdKuJqEILttPDHyjTqekaMk5QHJLEm3rTtyTfeHb14j4uvFF4c9DPHn+IiT Vm4ji4cU9RgYNeA6g6p/8uyV6Fx/TT16LFGifXdt9NegfrhN6CXZMJ/CmmNWS6+ZVIIq 8/W2Vp4tRvD7SGR98H3fNggf/z1+Urw1qZ1wQ1OeLjGowu3X/34XX23x0xKrhI0ayPCX yF4owOricrOIMw61SW2sqr1+gjVSL8z7k6ozLBZjJwP1RlvJFQ9tXVS+ZeE2hYKrSNOK hjCg== X-Gm-Message-State: AOJu0YxPxDKu3MPTpQXanNtD3suEBkk7HTdApEjc9awwI6ZeMGMBs69x tK1x5J1esQXq8Y0okM9mrbvom+H75PA= X-Google-Smtp-Source: AGHT+IHoAss49GNQGj8nytmCkgoLIlOhVVfRl2Y4sx8vq6a3pNlSdCuzSZTwvdoUckCEnr9Xc4YbCg== X-Received: by 2002:a2e:a786:0:b0:2b9:a156:6239 with SMTP id c6-20020a2ea786000000b002b9a1566239mr7228259ljf.1.1691937145017; Sun, 13 Aug 2023 07:32:25 -0700 (PDT) Received: from localhost.localdomain (46-116-229-137.bb.netvision.net.il. [46.116.229.137]) by smtp.gmail.com with ESMTPSA id sa17-20020a170906edb100b00993860a6d37sm4590695ejb.40.2023.08.13.07.32.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Aug 2023 07:32:24 -0700 (PDT) From: Sagi Grimberg To: stable@vger.kernel.org Subject: [PATCH 6.1.y] nvme-rdma: fix potential unbalanced freeze & unfreeze Date: Sun, 13 Aug 2023 17:32:22 +0300 Message-ID: <20230813143222.12569-1-sagi@grimberg.me> X-Mailer: git-send-email 2.41.0 In-Reply-To: <2023081240-wharf-throwing-7cf7@gregkh> References: <2023081240-wharf-throwing-7cf7@gregkh> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ming Lei Move start_freeze into nvme_rdma_configure_io_queues(), and there is at least two benefits: 1) fix unbalanced freeze and unfreeze, since re-connection work may fail or be broken by removal 2) IO during error recovery can be failfast quickly because nvme fabrics unquiesces queues after teardown. One side-effect is that !mpath request may timeout during connecting because of queue topo change, but that looks not one big deal: 1) same problem exists with current code base 2) compared with !mpath, mpath use case is dominant Fixes: 9f98772ba307 ("nvme-rdma: fix controller reset hang during traffic") Cc: stable@vger.kernel.org Signed-off-by: Ming Lei Tested-by: Yi Zhang Reviewed-by: Sagi Grimberg Signed-off-by: Keith Busch --- drivers/nvme/host/rdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 80383213b882..c478480f54aa 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -923,6 +923,7 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) goto out_cleanup_tagset; if (!new) { + nvme_start_freeze(&ctrl->ctrl); nvme_start_queues(&ctrl->ctrl); if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) { /* @@ -931,6 +932,7 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) * to be safe. */ ret = -ENODEV; + nvme_unfreeze(&ctrl->ctrl); goto out_wait_freeze_timed_out; } blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset, @@ -980,7 +982,6 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, bool remove) { if (ctrl->ctrl.queue_count > 1) { - nvme_start_freeze(&ctrl->ctrl); nvme_stop_queues(&ctrl->ctrl); nvme_sync_io_queues(&ctrl->ctrl); nvme_rdma_stop_io_queues(ctrl); -- 2.41.0