Skip to contentSkip to conversation

nvme: ensure unquiesce on teardown

PATCH In review Keith Busch 2 participants 6 messages Jun 28, 2023 – Jun 29, 2023 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 nvme: ensure unquiesce on teardown

From: Keith Busch <[email protected]>

The reset work is called on quiesced IO queues, so ensure these are unquiesced after a failed reset to flush out any pending requests.

---
 drivers/nvme/host/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
index b027e5e3f4acb..8eaa954aa6ed4 100644
@@ -2778,6 +2778,7 @@ static void nvme_reset_work(struct work_struct *work)
 	nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING);
 	nvme_dev_disable(dev, true);
 	nvme_mark_namespaces_dead(&dev->ctrl);
+	nvme_unquiesce_io_queues(&dev->ctrl);
 	nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD);
 }
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 nvme: sync timeout work on failed reset

From: Keith Busch <[email protected]>

Timeouts during reset will set the controller for failure, preventing the state change to LIVE. Ensure all timeout work is synced after the controller disabling completes so we don't have any other tasks messing with any namespace request_queues.

---
 drivers/nvme/host/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
index 8eaa954aa6ed4..bfeadecf9e15b 100644
@@ -2777,6 +2777,7 @@ static void nvme_reset_work(struct work_struct *work)
 		 result);
 	nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING);
 	nvme_dev_disable(dev, true);
+	nvme_sync_queues(&dev->ctrl);
 	nvme_mark_namespaces_dead(&dev->ctrl);
 	nvme_unquiesce_io_queues(&dev->ctrl);
 	nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD);
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] nvme: sync timeout work on failed reset

Quoted 6 lines · Keith Busch

From: Keith Busch <[email protected]>

Timeouts during reset will set the controller for failure, preventing the state change to LIVE. Ensure all timeout work is synced after the controller disabling completes so we don't have any other tasks messing with any namespace request_queues.

Looks good:

#3 lore raw

PATCH 3/3 nvme: disable controller on reset state failure

In reply to Keith Busch

From: Keith Busch <[email protected]>

If the controller is not in a RESETTING state at the point of reset work, we have to conclude the controller is being deleted. Go to the cleanup on this condition to ensure proper pairing of request_queue quiesce state.

---
 drivers/nvme/host/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
index bfeadecf9e15b..c9224d39195e5 100644
@@ -2690,7 +2690,8 @@ static void nvme_reset_work(struct work_struct *work)
 	if (dev->ctrl.state != NVME_CTRL_RESETTING) {
 		dev_warn(dev->ctrl.device, "ctrl state %d is not RESETTING\n",
 			 dev->ctrl.state);
-		return;
+		result = -ENODEV;
+		goto out;
 	}
 
 	/*
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] nvme: disable controller on reset state failure

Quoted 6 lines · Keith Busch

From: Keith Busch <[email protected]>

If the controller is not in a RESETTING state at the point of reset work, we have to conclude the controller is being deleted. Go to the cleanup on this condition to ensure proper pairing of request_queue quiesce state.

Looks good: