[PATCH 5/8] nvme: sync the namespace scanning during ctrl start
Max Gurtovoy
mgurtovoy at nvidia.com
Mon Jan 22 06:56:56 PST 2024
From: Ori Evron <oevron at nvidia.com>
The namespace identifiers may change during the re-connection flow.
Therefore, wait for the scanning to finish before finalizing the start
of the controller.
Also move the re-queueing of the old requests to the stage that we've
finished the namespace scanning otherwise we may issue a request to a
namespace that might have changed its identifiers.
Signed-off-by: Max Gurtovoy <mgurtovoy at nvidia.com>
Signed-off-by: Ori Evron <oevron at nvidia.com>
---
drivers/nvme/host/core.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d0e4888041aa..90ffb3db1ed9 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -593,14 +593,12 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
if (!changed)
return false;
- if (ctrl->state == NVME_CTRL_LIVE) {
- if (old_state == NVME_CTRL_CONNECTING)
- nvme_stop_failfast_work(ctrl);
- nvme_kick_requeue_lists(ctrl);
- } else if (ctrl->state == NVME_CTRL_CONNECTING &&
- old_state == NVME_CTRL_RESETTING) {
+ if (ctrl->state == NVME_CTRL_LIVE && old_state == NVME_CTRL_CONNECTING)
+ nvme_stop_failfast_work(ctrl);
+ else if (ctrl->state == NVME_CTRL_CONNECTING &&
+ old_state == NVME_CTRL_RESETTING)
nvme_start_failfast_work(ctrl);
- }
+
return changed;
}
EXPORT_SYMBOL_GPL(nvme_change_ctrl_state);
@@ -4287,6 +4285,7 @@ static void nvme_fw_act_work(struct work_struct *work)
return;
nvme_unquiesce_io_queues(ctrl);
+ nvme_kick_requeue_lists(ctrl);
/* read FW slot information to clear the AER */
nvme_get_fw_slot_info(ctrl);
@@ -4537,9 +4536,10 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
nvme_change_uevent(ctrl, "NVME_EVENT=rediscover");
if (ctrl->queue_count > 1) {
- nvme_queue_scan(ctrl);
+ nvme_queue_scan_sync(ctrl);
nvme_unquiesce_io_queues(ctrl);
nvme_mpath_update(ctrl);
+ nvme_kick_requeue_lists(ctrl);
}
nvme_change_uevent(ctrl, "NVME_EVENT=connected");
--
2.18.1
More information about the Linux-nvme
mailing list