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 2/4] nvme: add nvme_unfreeze_force()
Date: Tue, 20 Jun 2023 09:33:47 +0800 [thread overview]
Message-ID: <20230620013349.906601-3-ming.lei@redhat.com> (raw)
In-Reply-To: <20230620013349.906601-1-ming.lei@redhat.com>
Add nvme_unfreeze_force() for fixing IO hang during removing namespaces
from error recovery.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
drivers/nvme/host/core.c | 21 ++++++++++++++++++---
drivers/nvme/host/nvme.h | 1 +
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 76e8f8b4098e..6b3f12368196 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4579,17 +4579,32 @@ void nvme_mark_namespaces_dead(struct nvme_ctrl *ctrl)
}
EXPORT_SYMBOL_GPL(nvme_mark_namespaces_dead);
-void nvme_unfreeze(struct nvme_ctrl *ctrl)
+static void __nvme_unfreeze(struct nvme_ctrl *ctrl, bool force)
{
struct nvme_ns *ns;
down_read(&ctrl->namespaces_rwsem);
- list_for_each_entry(ns, &ctrl->namespaces, list)
- blk_mq_unfreeze_queue(ns->queue);
+ list_for_each_entry(ns, &ctrl->namespaces, list) {
+ if (force)
+ blk_mq_unfreeze_queue_force(ns->queue);
+ else
+ blk_mq_unfreeze_queue(ns->queue);
+ }
up_read(&ctrl->namespaces_rwsem);
}
+
+void nvme_unfreeze(struct nvme_ctrl *ctrl)
+{
+ __nvme_unfreeze(ctrl, false);
+}
EXPORT_SYMBOL_GPL(nvme_unfreeze);
+void nvme_unfreeze_force(struct nvme_ctrl *ctrl)
+{
+ __nvme_unfreeze(ctrl, true);
+}
+EXPORT_SYMBOL_GPL(nvme_unfreeze_force);
+
int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
{
struct nvme_ns *ns;
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 78308f15e090..b583bab985c3 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -765,6 +765,7 @@ void nvme_mark_namespaces_dead(struct nvme_ctrl *ctrl);
void nvme_sync_queues(struct nvme_ctrl *ctrl);
void nvme_sync_io_queues(struct nvme_ctrl *ctrl);
void nvme_unfreeze(struct nvme_ctrl *ctrl);
+void nvme_unfreeze_force(struct nvme_ctrl *ctrl);
void nvme_wait_freeze(struct nvme_ctrl *ctrl);
int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
void nvme_start_freeze(struct nvme_ctrl *ctrl);
--
2.40.1
next prev 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 ` Ming Lei [this message]
2023-06-20 1:33 ` [PATCH V2 3/4] nvme: unfreeze queues before removing namespaces Ming Lei
2023-06-20 1:33 ` [PATCH V2 4/4] nvme: unquiesce io queues when " 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-3-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