public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Chao Leng <lengchao@huawei.com>, Christoph Hellwig <hch@lst.de>,
	Sasha Levin <sashal@kernel.org>,
	linux-nvme@lists.infradead.org
Subject: [PATCH AUTOSEL 5.4 28/40] nvme-tcp: add clean action for failed reconnection
Date: Wed, 24 Feb 2021 07:53:28 -0500	[thread overview]
Message-ID: <20210224125340.483162-28-sashal@kernel.org> (raw)
In-Reply-To: <20210224125340.483162-1-sashal@kernel.org>

From: Chao Leng <lengchao@huawei.com>

[ Upstream commit 70a99574a79f1cd4dc7ad56ea37be40844bfb97b ]

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 <lengchao@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/nvme/host/tcp.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index a554021e1ab92..77a3c488ec120 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1710,8 +1710,10 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
 
 out_wait_freeze_timed_out:
 	nvme_stop_queues(ctrl);
+	nvme_sync_io_queues(ctrl);
 	nvme_tcp_stop_io_queues(ctrl);
 out_cleanup_connect_q:
+	nvme_cancel_tagset(ctrl);
 	if (new)
 		blk_cleanup_queue(ctrl->connect_q);
 out_free_tag_set:
@@ -1773,12 +1775,16 @@ static int nvme_tcp_configure_admin_queue(struct nvme_ctrl *ctrl, bool new)
 
 	error = nvme_init_identify(ctrl);
 	if (error)
-		goto out_stop_queue;
+		goto out_quiesce_queue;
 
 	return 0;
 
+out_quiesce_queue:
+	blk_mq_quiesce_queue(ctrl->admin_q);
+	blk_sync_queue(ctrl->admin_q);
 out_stop_queue:
 	nvme_tcp_stop_queue(ctrl, 0);
+	nvme_cancel_admin_tagset(ctrl);
 out_cleanup_queue:
 	if (new)
 		blk_cleanup_queue(ctrl->admin_q);
@@ -1892,10 +1898,18 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
 	return 0;
 
 destroy_io:
-	if (ctrl->queue_count > 1)
+	if (ctrl->queue_count > 1) {
+		nvme_stop_queues(ctrl);
+		nvme_sync_io_queues(ctrl);
+		nvme_tcp_stop_io_queues(ctrl);
+		nvme_cancel_tagset(ctrl);
 		nvme_tcp_destroy_io_queues(ctrl, new);
+	}
 destroy_admin:
+	blk_mq_quiesce_queue(ctrl->admin_q);
+	blk_sync_queue(ctrl->admin_q);
 	nvme_tcp_stop_queue(ctrl, 0);
+	nvme_cancel_admin_tagset(ctrl);
 	nvme_tcp_destroy_admin_queue(ctrl, new);
 	return ret;
 }
-- 
2.27.0


  parent reply	other threads:[~2021-02-24 13:16 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 12:53 [PATCH AUTOSEL 5.4 01/40] staging: fwserial: Fix error handling in fwserial_create Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 02/40] x86/reboot: Add Zotac ZBOX CI327 nano PCI reboot quirk Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 03/40] vt/consolemap: do font sum unsigned Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 04/40] wlcore: Fix command execute failure 19 for wl12xx Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 05/40] Bluetooth: hci_h5: Set HCI_QUIRK_SIMULTANEOUS_DISCOVERY for btrtl Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 06/40] pktgen: fix misuse of BUG_ON() in pktgen_thread_worker() Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 07/40] ath10k: fix wmi mgmt tx queue full due to race condition Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 08/40] x86/build: Treat R_386_PLT32 relocation as R_386_PC32 Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 09/40] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 10/40] staging: most: sound: add sanity check for function argument Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 11/40] staging: bcm2835-audio: Replace unsafe strcpy() with strscpy() Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 12/40] brcmfmac: Add DMI nvram filename quirk for Predia Basic tablet Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 13/40] brcmfmac: Add DMI nvram filename quirk for Voyo winpad A15 tablet Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 14/40] drm/hisilicon: Fix use-after-free Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 15/40] udlfb: Fix memory leak in dlfb_usb_probe Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 16/40] crypto: tcrypt - avoid signed overflow in byte count Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 17/40] drm/amdgpu: Add check to prevent IH overflow Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 18/40] PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 19/40] drm/amd/display: Guard against NULL pointer deref when get_i2c_info fails Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 20/40] media: mceusb: sanity check for prescaler value Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 21/40] media: v4l2-ctrls.c: fix shift-out-of-bounds in std_validate Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 22/40] media: uvcvideo: Allow entities with no pads Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 23/40] f2fs: handle unallocated section and zone on pinned/atgc Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 24/40] f2fs: fix to set/clear I_LINKABLE under i_lock Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 25/40] tomoyo: ignore data race while checking quota Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 26/40] nvme-core: add cancel tagset helpers Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 27/40] nvme-rdma: add clean action for failed reconnection Sasha Levin
2021-02-24 12:53 ` Sasha Levin [this message]
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 29/40] smackfs: restrict bytes count in smackfs write functions Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 30/40] Drivers: hv: vmbus: Resolve race condition in vmbus_onoffer_rescind() Sasha Levin
2021-02-24 13:20   ` Andrea Parri
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 31/40] ASoC: Intel: Add DMI quirk table to soc_intel_is_byt_cr() Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 32/40] btrfs: fix error handling in commit_fs_roots Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 33/40] perf/x86/kvm: Add Cascade Lake Xeon steppings to isolation_ucodes[] Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 34/40] erofs: fix shift-out-of-bounds of blkszbits Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 35/40] parisc: Bump 64-bit IRQ stack size to 64 KB Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 36/40] sched/features: Fix hrtick reprogramming Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 37/40] ASoC: Intel: bytcr_rt5640: Add quirk for the Estar Beauty HD MID 7316R tablet Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 38/40] ASoC: Intel: bytcr_rt5640: Add quirk for the Voyo Winpad A15 tablet Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 39/40] ASoC: Intel: bytcr_rt5651: Add quirk for the Jumper EZpad 7 tablet Sasha Levin
2021-02-24 12:53 ` [PATCH AUTOSEL 5.4 40/40] ASoC: Intel: bytcr_rt5640: Add quirk for the Acer One S1002 tablet Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210224125340.483162-28-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=hch@lst.de \
    --cc=lengchao@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox