public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>, 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 V2 3/4] nvme: unfreeze queues before removing namespaces
Date: Tue, 20 Jun 2023 09:33:48 +0800	[thread overview]
Message-ID: <20230620013349.906601-4-ming.lei@redhat.com> (raw)
In-Reply-To: <20230620013349.906601-1-ming.lei@redhat.com>

If removal is from breaking error recovery, queues may be frozen, and
there may be pending IOs in bio_queue_enter(), and the following
del_gendisk() may wait for these IOs, especially from writeback.

Similar IO hang exists in flushing scan work too if there are pending
IO in scan work context.

Fix the kind of issue by unfreezing queues before removing namespace,
so that all pending IOs can be handled.

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

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 6b3f12368196..7d8ff58660ee 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4002,6 +4002,9 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
 	 */
 	nvme_mpath_clear_ctrl_paths(ctrl);
 
+	/* unfreeze queues which may be frozen from error recovery */
+	nvme_unfreeze_force(ctrl);
+
 	/* prevent racing with ns scanning */
 	flush_work(&ctrl->scan_work);
 
-- 
2.40.1



  parent reply	other threads:[~2023-06-20  1:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20  1:33 [PATCH V2 0/4] nvme: fix two kinds of IO hang from removing NSs Ming Lei
2023-06-20  1:33 ` [PATCH V2 1/4] blk-mq: add API of blk_mq_unfreeze_queue_force Ming Lei
2023-06-20  1:33 ` [PATCH V2 2/4] nvme: add nvme_unfreeze_force() Ming Lei
2023-06-20  1:33 ` Ming Lei [this message]
2023-06-20  1:33 ` [PATCH V2 4/4] nvme: unquiesce io queues when removing namespaces Ming Lei
2023-06-20 10:04 ` [PATCH V2 0/4] nvme: fix two kinds of IO hang from removing NSs Sagi Grimberg
2023-06-20 13:23   ` Ming Lei
2023-06-20 13:40     ` Sagi Grimberg
2023-06-21  0:09       ` Ming Lei
2023-06-21 10:13         ` Sagi Grimberg
2023-06-21 13:27           ` Ming Lei
2023-06-21 15:48             ` Keith Busch
2023-06-22 13:51               ` Ming Lei
2023-06-22 14:35                 ` Keith Busch
2023-06-22 14:53                   ` Ming Lei
2023-06-22 15:19                     ` Keith Busch
2023-06-25  0:26                       ` Ming Lei
2023-06-25  8:09                         ` Sagi Grimberg
2023-06-27 17:21                         ` Keith Busch
2023-06-27 21:15                           ` Sagi Grimberg
2023-06-28  1:30                           ` Ming Lei
2023-06-28 14:35                             ` Keith Busch
2023-06-29  0:08                               ` Ming Lei
2023-06-29 15:33                                 ` Keith Busch
2023-06-28  7:06                           ` Ming Lei
2023-06-28  7:26                             ` Sagi Grimberg

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=20230620013349.906601-4-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --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