Linux block layer
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <kbusch@kernel.org>,
	linux-nvme@lists.infradead.org
Cc: Yi Zhang <yi.zhang@redhat.com>,
	linux-block@vger.kernel.org, Chunguang Xu <brookxu.cn@gmail.com>,
	Ming Lei <ming.lei@redhat.com>
Subject: [PATCH 1/2] nvme: core: unquiesce io queues when removing namespaces
Date: Tue, 13 Jun 2023 08:58:46 +0800	[thread overview]
Message-ID: <20230613005847.1762378-2-ming.lei@redhat.com> (raw)
In-Reply-To: <20230613005847.1762378-1-ming.lei@redhat.com>

When error recovery is interrupted by controller removal, the controller
is left as quiesced, then IO hang can be caused.

Fix the issue by unquiescing controller unconditionally when removing
namespaces.

Reported-by: Chunguang Xu <brookxu.cn@gmail.com>
Closes: https://lore.kernel.org/linux-nvme/cover.1685350577.git.chunguang.xu@shopee.com/
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 drivers/nvme/host/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 3ec38e2b9173..4ef5eaecaa75 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4692,6 +4692,12 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
 	 */
 	nvme_mpath_clear_ctrl_paths(ctrl);
 
+	/*
+	 * Unquiesce io queues so any pending IO won't hang, especially
+	 * those submitted from scan work
+	 */
+	nvme_unquiesce_io_queues(ctrl);
+
 	/* prevent racing with ns scanning */
 	flush_work(&ctrl->scan_work);
 
-- 
2.40.1


  reply	other threads:[~2023-06-13  1:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13  0:58 [PATCH 0/2] nvme: fix two kinds of IO hang from removing NSs Ming Lei
2023-06-13  0:58 ` Ming Lei [this message]
2023-06-13 13:16   ` [PATCH 1/2] nvme: core: unquiesce io queues when removing namespaces Sagi Grimberg
2023-06-13  0:58 ` [PATCH 2/2] nvme: don't freeze/unfreeze queues from different contexts Ming Lei
2023-06-13 13:13   ` Sagi Grimberg
2023-06-13 13:20     ` Ming Lei
2023-06-13 13:26       ` Sagi Grimberg
2023-06-13 14:41   ` Keith Busch
2023-06-13 20:34     ` Sagi Grimberg
2023-06-13 22:43       ` Keith Busch
2023-06-14  0:38     ` Ming Lei

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=20230613005847.1762378-2-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=brookxu.cn@gmail.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=yi.zhang@redhat.com \
    /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