Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1975128pxb; Fri, 5 Mar 2021 04:33:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqkc6mIQSLw10/8zVHuAmD3m/hX+PPtaBob/xH9lytBNnq0uiKVeNkvZU7P/qpiXFwy3NG X-Received: by 2002:a50:9ea4:: with SMTP id a33mr9004686edf.295.1614947613241; Fri, 05 Mar 2021 04:33:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947613; cv=none; d=google.com; s=arc-20160816; b=u3TqsxZaJVZw2IIrE2mrDjBoLwGMmQAH9nOoaOBduth4/osSLIPmpObpBDyl120n0M zhGZKGH2zHctLS1INhPSKYQyud/7JNO2iIqMdIkgH9TOdcmH8HOP5wCi004T9BUAM+GR aBYBoK2sY+mzLL70f7EOuI4PVyLpUe7JfYHqrqBSF6gQTcqITQvk2YHukv9G0UYfgppe cZV+H1iIt7ee7QI9TS/fYhAVApv4r3+2Wtv0GLFr+f8pJbW5x5TmjuXy6Ao1AOvx1py2 ld2izbYmzuh9GArwVmatBp6oK4fRNKBI9qBrcEqFb58c2QiAfgxFn5d65U+OrUuyzTpu Ehag== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LGpRM9wwWvE1K6/wZQI9iOymUJt57DANu9ob0XWRJHA=; b=GuONwdci8oGb5C8+a/vtlfsWxuSMu8r6P6SPwBX2zYBL86Le71gGRTLWYZiNxwBiEC z3Qed7mCTkv2g3+UZRgnN7Or8+1mLCPBy+xvzomP2D5fFDbnxYS5pfOsgzhWWV91rL5m SmyCHQi3uTF6ZqbwVGpqQ77LXf17k+ppCPzBLPJNHZpRQG2AFqONgwQgftqqk6roEFh0 79l79lh24ZOhjSa50KzRreX6JZX4FKHSdm9cdIeDXpxAUozr9PzuB7leauFWW2hIdOf5 ymPKvASoUV7T7SwLdKp5pyD2nl0F4UsDuPdD2FmHuQAmk47hXzZPe95LA1OEC3Dookr8 fVyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="HeDxU4/s"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si1531801edu.567.2021.03.05.04.33.08; Fri, 05 Mar 2021 04:33:33 -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=@linuxfoundation.org header.s=korg header.b="HeDxU4/s"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbhCEMbk (ORCPT + 99 others); Fri, 5 Mar 2021 07:31:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:40892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231504AbhCEMaw (ORCPT ); Fri, 5 Mar 2021 07:30:52 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B130765029; Fri, 5 Mar 2021 12:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947451; bh=MTFjmCUYHEfjoNJ7NLmabPm5GwToGEZ97xs/BaabEu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HeDxU4/s0KJladIHk8FmjbMRoYfDWuHtuYJbahBrpNY8fC+CKwQ8/g43qdSuHAll+ g/ChhA3J+6YpB+ezgH1JCPPuygioAKZ5hpB0fL5d3iKLRB2aVOI3jcn9pAKPgpgIa9 wUYqRCkYMekYnyVwQmONjPTuDJ4QIvsD7BSqjtW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.10 069/102] nvme-rdma: add clean action for failed reconnection Date: Fri, 5 Mar 2021 13:21:28 +0100 Message-Id: <20210305120906.674604443@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120903.276489876@linuxfoundation.org> References: <20210305120903.276489876@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 4eb867804b6a..195703013272 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -919,12 +919,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); @@ -1001,8 +1005,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: @@ -1144,10 +1150,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.30.1