Commit bd46a906 authored by Keith Busch's avatar Keith Busch Committed by Sagi Grimberg

nvme-pci: Fix async probe remove race

Ensure the controller is not in the NEW state when nvme_probe() exits.
This will always allow a subsequent nvme_remove() to set the state to
DELETING, fixing a potential race between the initial asynchronous probe
and device removal.
Reported-by: default avatarLi Zhong <lizhongfs@gmail.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
parent 0157ec8d
...@@ -2695,7 +2695,7 @@ static void nvme_async_probe(void *data, async_cookie_t cookie) ...@@ -2695,7 +2695,7 @@ static void nvme_async_probe(void *data, async_cookie_t cookie)
{ {
struct nvme_dev *dev = data; struct nvme_dev *dev = data;
nvme_reset_ctrl_sync(&dev->ctrl); flush_work(&dev->ctrl.reset_work);
flush_work(&dev->ctrl.scan_work); flush_work(&dev->ctrl.scan_work);
nvme_put_ctrl(&dev->ctrl); nvme_put_ctrl(&dev->ctrl);
} }
...@@ -2761,6 +2761,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -2761,6 +2761,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev)); dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev));
nvme_reset_ctrl(&dev->ctrl);
nvme_get_ctrl(&dev->ctrl); nvme_get_ctrl(&dev->ctrl);
async_schedule(nvme_async_probe, dev); async_schedule(nvme_async_probe, dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment