When we have a non-present controller there is no reason to wait in
marking the namespaces dead, so do it ASAP. Also remove the superflous
call to nvme_start_queues as nvme_dev_disable already did that for us.
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
drivers/nvme/host/pci.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 8ab54857cfd50..bef98f6e1396c 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3244,25 +3244,19 @@ static void nvme_remove(struct pci_dev *pdev)
nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING);
pci_set_drvdata(pdev, NULL);
+ /*
+ * Mark the namespaces dead as we can't flush the data, and
disable the
+ * controller ASAP as we can't shut it down properly if it was
surprise
+ * removed.
+ */
if (!pci_device_is_present(pdev)) {
nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD);
+ nvme_mark_namespaces_dead(&dev->ctrl);
Don't you need to start the queues as well here?
nevermind, you call disable with shutdown=true
nvme_dev_disable(dev, true);