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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C736EB64DC for ; Tue, 11 Jul 2023 09:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lpRPIV/LMf48tH1P6agBoHHDbL9BC4YkoFKumHfeZPM=; b=OWgxpU5KmeqzUTaHjFTDNrm4Gk kANkmlX6hsrFdD6fEtnZIW6h5aWCRIKWSZG6TSssQsedEsibi0VlL39Cpizbh2KDQGl6vdPhW6HTS tItSwHUPB4rRqf7prSj6IdsKHoMhPXPV7FUsTbcQNNYVIfKK9gjfhhCageRKUQmXGCMzD2GGyDElk Lozr7i5v8rpt+XF5jxD3ihGGVY/58WDAUdTlH6HLrbU0KbhuGB7fPXbd+vYJrBEUq0QMBrGMghe41 QDvBuq8mxC32AP3r8sqiOcVAR7f9D38KB1Ys3uf2PhZAXiBEvzhlbwXaqydypBYsrjWwBTzeWUG63 CnA86MqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJ9rp-00EKIv-0X; Tue, 11 Jul 2023 09:41:09 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qJ9rm-00EKHJ-1y for linux-nvme@lists.infradead.org; Tue, 11 Jul 2023 09:41:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689068465; h=from:from:reply-to:subject:subject: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=lpRPIV/LMf48tH1P6agBoHHDbL9BC4YkoFKumHfeZPM=; b=JR4U4aapu6cSfsE8I0nAYCFMKPPde7m2/q3ifKEm44pmMuXX/ixvfR2u6/Wfa7W8aXYO/t 7nac8PJ+TrIoEp+huQSMgNybY+jD6SSB/3WRfo+MpMnp2fls5GAsaCw+FjRZGtWABM8k/Z 69zMzIcGozUcPID2sw/dNF3aGmkzMBA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-137--5_i2DNCOxeAxsFmtCvvxg-1; Tue, 11 Jul 2023 05:41:01 -0400 X-MC-Unique: -5_i2DNCOxeAxsFmtCvvxg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E51CD1C04B4C; Tue, 11 Jul 2023 09:41:00 +0000 (UTC) Received: from localhost (ovpn-8-22.pek2.redhat.com [10.72.8.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12B96492B01; Tue, 11 Jul 2023 09:40:59 +0000 (UTC) From: Ming Lei To: Christoph Hellwig , Sagi Grimberg , Keith Busch , linux-nvme@lists.infradead.org Cc: Yi Zhang , Chunguang Xu , Ming Lei , stable@vger.kernel.org Subject: [PATCH V2 2/3] nvme-tcp: fix potential unbalanced freeze & unfreeze Date: Tue, 11 Jul 2023 17:40:40 +0800 Message-Id: <20230711094041.1819102-3-ming.lei@redhat.com> In-Reply-To: <20230711094041.1819102-1-ming.lei@redhat.com> References: <20230711094041.1819102-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230711_024106_721583_B0F283F1 X-CRM114-Status: GOOD ( 13.93 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org Move start_freeze into nvme_tcp_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: 2875b0aecabe ("nvme-tcp: fix controller reset hang during traffic") Cc: stable@vger.kernel.org Signed-off-by: Ming Lei --- drivers/nvme/host/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 3e7dd6f91832..fb24cd8ac46c 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1868,6 +1868,7 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) goto out_cleanup_connect_q; if (!new) { + nvme_start_freeze(ctrl); nvme_unquiesce_io_queues(ctrl); if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) { /* @@ -1876,6 +1877,7 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) * to be safe. */ ret = -ENODEV; + nvme_unfreeze(ctrl); goto out_wait_freeze_timed_out; } blk_mq_update_nr_hw_queues(ctrl->tagset, @@ -1980,7 +1982,6 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, if (ctrl->queue_count <= 1) return; nvme_quiesce_admin_queue(ctrl); - nvme_start_freeze(ctrl); nvme_quiesce_io_queues(ctrl); nvme_sync_io_queues(ctrl); nvme_tcp_stop_io_queues(ctrl); -- 2.40.1