Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp421664pxb; Wed, 24 Feb 2021 05:58:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6ga6orxcOgUyRLEMwXFncrLV+R7wE9/Mu9sC1tOuqwhPdeGE//LTFHf+RI8fhCd1kH8x4 X-Received: by 2002:a50:bf42:: with SMTP id g2mr33245451edk.101.1614175137847; Wed, 24 Feb 2021 05:58:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614175137; cv=none; d=google.com; s=arc-20160816; b=ljq0D89t/cKuYDhxY90Sq7lQC1ujnUSjY4OJYtrow9psZ/aiCDtEVeJjCUzGKj6jRV sdazlwcHbsbRFqa7kXbclQlAgpChXWgixhtyl8ZSVkyUjq8NlzeDqJ0Qgb2xqUH3cpz3 8MAwpIy0bD1qGxVLNDqs+SNJsDP+nkS8OEFUxL6kzBlcn0XzD9/kaKfbwTOukq1X2Aj6 j2d4nXnqJgEEvLDPHQTqvlG/aueGSTbAhRQAlihmPmh/YWDVi1JqC3IB7Qz1H3TKBHjm rRNG8KkI1/j24Rotdc/j8FziozVOspKxJPPKLOGxwonY6iNcgGJs2dLX3UmP/Kl/9bh6 ARtQ== 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; bh=zBZnrZKPEhZD4IXjghFrNLQ7xG/Dk6om6vGX8uRh0x4=; b=H0+/UQVcL0zwQZSI/7s/Viqyigjg4itnk2l49ssgpUOkc34E7ju1yIe13j5oSsNaQG 9edYTvgP1aCfXEAES/ZbWtZBshglVaXzWacnXkt1eaZlNewKuXMdc/jWoAZwUOXI/jqL vH5esD6TAn2EwTYplUdJSTV7juIjAoSPHvyVw1SF+kTMNlwTaztYIoUSGj9NDAgiQU5/ 4GAVyZDXstOFXXBzjWlYJXu9yT9lIQsRJzf9CXA+7h6lcn9wblnbJ0GxrTvfomRcqLFe MmT/WnEOJ9HK+HkLK0d0cIdbvFpi0qmM4kcq/DGCcMPsl4vigotnNZ8+KoFbipLgPDxT Qb5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bM9KxqRA; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk24si1248142edb.238.2021.02.24.05.58.33; Wed, 24 Feb 2021 05:58:57 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=bM9KxqRA; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235890AbhBXN6G (ORCPT + 99 others); Wed, 24 Feb 2021 08:58:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:58132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235764AbhBXNGV (ORCPT ); Wed, 24 Feb 2021 08:06:21 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1B64B64F8B; Wed, 24 Feb 2021 12:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614171256; bh=vOaq+XCE08cfBU4HxzIJMSbb7MRGJapuX0It14Owib8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bM9KxqRA6z2m0ZU2EeSassWWuusTb9tgBUXiQsRknFSg+4GZSTGitCmSfehsvpR2W lLODVM9gRaoE40szPo3RIHg535Bec30yHNkMud2BdTYRoNy33JuXh2bHXbkfhPV3u5 J7P0r4fROgDlODpSsiFP4i2J4gR1NPDIubMj9g7DR+TGte22cL/KeWIjKtbjW5vcr9 +bsgSTVlM9Uwu/k9XsztyBBXru6H3C92mDLrnhpmqC+YsKz7SaANMy5yKg36mOrq3l jSE8ydG0CkMWObtn1gw+a+DD+eWQ1pLNl0V3QKolUvzf0qbRtZ7BAfM6KEp+TbX1Si jkcwfqrn/Fd+Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chao Leng , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 27/40] nvme-rdma: add clean action for failed reconnection Date: Wed, 24 Feb 2021 07:53:27 -0500 Message-Id: <20210224125340.483162-27-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224125340.483162-1-sashal@kernel.org> References: <20210224125340.483162-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: Chao Leng [ Upstream commit 958dc1d32c80566f58d18f05ef1f05bd32d172c1 ] A crash happens when inject failed reconnection. If reconnect failed after start io queues, the queues will be unquiesced and new requests continue to be delivered. Reconnection error handling process directly free queues without cancel suspend requests. The suppend request will time out, and then crash due to use the queue after free. Add sync queues and cancel suppend requests for reconnection error handling. Signed-off-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/rdma.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 8a62c2fe5a5ec..da60300104322 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -835,12 +835,16 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, error = nvme_init_identify(&ctrl->ctrl); if (error) - goto out_stop_queue; + goto out_quiesce_queue; return 0; +out_quiesce_queue: + blk_mq_quiesce_queue(ctrl->ctrl.admin_q); + blk_sync_queue(ctrl->ctrl.admin_q); out_stop_queue: nvme_rdma_stop_queue(&ctrl->queues[0]); + nvme_cancel_admin_tagset(&ctrl->ctrl); out_cleanup_queue: if (new) blk_cleanup_queue(ctrl->ctrl.admin_q); @@ -917,8 +921,10 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) out_wait_freeze_timed_out: nvme_stop_queues(&ctrl->ctrl); + nvme_sync_io_queues(&ctrl->ctrl); nvme_rdma_stop_io_queues(ctrl); out_cleanup_connect_q: + nvme_cancel_tagset(&ctrl->ctrl); if (new) blk_cleanup_queue(ctrl->ctrl.connect_q); out_free_tag_set: @@ -1054,10 +1060,18 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new) return 0; destroy_io: - if (ctrl->ctrl.queue_count > 1) + if (ctrl->ctrl.queue_count > 1) { + nvme_stop_queues(&ctrl->ctrl); + nvme_sync_io_queues(&ctrl->ctrl); + nvme_rdma_stop_io_queues(ctrl); + nvme_cancel_tagset(&ctrl->ctrl); nvme_rdma_destroy_io_queues(ctrl, new); + } destroy_admin: + blk_mq_quiesce_queue(ctrl->ctrl.admin_q); + blk_sync_queue(ctrl->ctrl.admin_q); nvme_rdma_stop_queue(&ctrl->queues[0]); + nvme_cancel_admin_tagset(&ctrl->ctrl); nvme_rdma_destroy_admin_queue(ctrl, new); return ret; } -- 2.27.0