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 2/4] nvme: add nvme_unfreeze_force()
Date: Thu, 15 Jun 2023 22:32:34 +0800 [thread overview]
Message-ID: <20230615143236.297456-3-ming.lei@redhat.com> (raw)
In-Reply-To: <20230615143236.297456-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 c3d72fc677f7..96785913845b 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -5220,17 +5220,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 953e59f56139..33b740808e7b 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -764,6 +764,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-15 14:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 14:32 [PATCH 0/4] nvme: fix two kinds of IO hang from removing NSs Ming Lei
2023-06-15 14:32 ` [PATCH 1/4] blk-mq: add API of blk_mq_unfreeze_queue_force Ming Lei
2023-06-15 15:16 ` Keith Busch
2023-06-15 15:43 ` Ming Lei
2023-06-16 5:48 ` Christoph Hellwig
2023-06-16 7:20 ` Ming Lei
2023-06-16 7:27 ` Christoph Hellwig
2023-06-16 7:33 ` Ming Lei
2023-06-20 5:41 ` Christoph Hellwig
2023-06-20 10:01 ` Sagi Grimberg
2023-06-20 13:15 ` Ming Lei
2023-06-15 14:32 ` Ming Lei [this message]
2023-06-15 14:32 ` [PATCH 3/4] nvme: unfreeze queues before removing namespaces Ming Lei
2023-06-15 14:32 ` [PATCH 4/4] nvme: unquiesce io queues when " 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=20230615143236.297456-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