From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Nilay Shroff <nilay@linux.ibm.com>,
Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
Sasha Levin <sashal@kernel.org>,
sagi@grimberg.me, kch@nvidia.com, linux-nvme@lists.infradead.org
Subject: [PATCH AUTOSEL 6.11 29/30] nvme-loop: flush off pending I/O while shutting down loop controller
Date: Wed, 23 Oct 2024 10:29:54 -0400 [thread overview]
Message-ID: <20241023143012.2980728-29-sashal@kernel.org> (raw)
In-Reply-To: <20241023143012.2980728-1-sashal@kernel.org>
From: Nilay Shroff <nilay@linux.ibm.com>
[ Upstream commit c199fac88fe7c749f88a0653e9f621b9f5a71cf1 ]
While shutting down loop controller, we first quiesce the admin/IO queue,
delete the admin/IO tag-set and then at last destroy the admin/IO queue.
However it's quite possible that during the window between quiescing and
destroying of the admin/IO queue, some admin/IO request might sneak in
and if that happens then we could potentially encounter a hung task
because shutdown operation can't forward progress until any pending I/O
is flushed off.
This commit helps ensure that before destroying the admin/IO queue, we
unquiesce the admin/IO queue so that any outstanding requests, which are
added after the admin/IO queue is quiesced, are now flushed to its
completion.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/loop.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index e32790d8fc260..a9d112d34d4f4 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -265,6 +265,13 @@ static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl)
{
if (!test_and_clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags))
return;
+ /*
+ * It's possible that some requests might have been added
+ * after admin queue is stopped/quiesced. So now start the
+ * queue to flush these requests to the completion.
+ */
+ nvme_unquiesce_admin_queue(&ctrl->ctrl);
+
nvmet_sq_destroy(&ctrl->queues[0].nvme_sq);
nvme_remove_admin_tag_set(&ctrl->ctrl);
}
@@ -297,6 +304,12 @@ static void nvme_loop_destroy_io_queues(struct nvme_loop_ctrl *ctrl)
nvmet_sq_destroy(&ctrl->queues[i].nvme_sq);
}
ctrl->ctrl.queue_count = 1;
+ /*
+ * It's possible that some requests might have been added
+ * after io queue is stopped/quiesced. So now start the
+ * queue to flush these requests to the completion.
+ */
+ nvme_unquiesce_io_queues(&ctrl->ctrl);
}
static int nvme_loop_init_io_queues(struct nvme_loop_ctrl *ctrl)
--
2.43.0
next prev parent reply other threads:[~2024-10-23 14:32 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 14:29 [PATCH AUTOSEL 6.11 01/30] 9p: v9fs_fid_find: also lookup by inode if not found dentry Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 02/30] 9p: Avoid creating multiple slab caches with the same name Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 03/30] selftests/bpf: Verify that sync_linked_regs preserves subreg_def Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 04/30] nvmet-passthru: clear EUID/NGUID/UUID while using loop target Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 05/30] irqchip/ocelot: Fix trigger register address Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 06/30] pinctrl: aw9523: add missing mutex_destroy Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 07/30] pinctrl: intel: platform: Add Panther Lake to the list of supported Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 08/30] nvme: tcp: avoid race between queue_lock lock and destroy Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 09/30] block: Fix elevator_get_default() checking for NULL q->tag_set Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 10/30] HID: multitouch: Add support for B2402FVA track point Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 11/30] HID: multitouch: Add quirk for HONOR MagicBook Art 14 touchpad Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 12/30] iommu/arm-smmu: Clarify MMU-500 CPRE workaround Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 13/30] nvme: disable CC.CRIME (NVME_CC_CRIME) Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 14/30] bpf: use kvzmalloc to allocate BPF verifier environment Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 15/30] crypto: api - Fix liveliness check in crypto_alg_tested Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 16/30] crypto: marvell/cesa - Disable hash algorithms Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 17/30] s390/ap: Fix CCA crypto card behavior within protected execution environment Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 18/30] sound: Make CONFIG_SND depend on INDIRECT_IOMEM instead of UML Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 19/30] drm/vmwgfx: Limit display layout ioctl array size to VMWGFX_NUM_DISPLAY_UNITS Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 20/30] selftests/bpf: Assert link info uprobe_multi count & path_size if unset Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 21/30] RDMA/siw: Add sendpage_ok() check to disable MSG_SPLICE_PAGES Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 22/30] ALSA: hda/tas2781: Add new quirk for Lenovo, ASUS, Dell projects Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 23/30] kasan: Disable Software Tag-Based KASAN with GCC Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 24/30] nvme-multipath: defer partition scanning Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 25/30] drm/amdkfd: Accounting pdd vram_usage for svm Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 26/30] powerpc/powernv: Free name on error in opal_event_init() Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 27/30] net: phy: mdio-bcm-unimac: Add BCM6846 support Sasha Levin
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 28/30] drm/xe/query: Increase timestamp width Sasha Levin
2024-10-23 14:29 ` Sasha Levin [this message]
2024-10-23 14:29 ` [PATCH AUTOSEL 6.11 30/30] nvme: make keep-alive synchronous operation 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=20241023143012.2980728-29-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=nilay@linux.ibm.com \
--cc=sagi@grimberg.me \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.