NVMe: Fix filesystem deadlock on removal
authorKeith Busch <keith.busch@intel.com>
Thu, 18 Jun 2015 19:36:40 +0000 (13:36 -0600)
committerJens Axboe <axboe@fb.com>
Sat, 27 Jun 2015 17:42:54 +0000 (11:42 -0600)
Move gendisk deletion before controller shutdown so filesystem may sync
dirty pages. Before, this would deadlock trying to allocate requests
on frozen queues that are about to be deleted.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nvme-core.c

index 22761a6c34aa6edeae71a38db5ced7260228664a..75a914914c412c3d828df3ecb7cb0d690481a042 100644 (file)
@@ -3124,8 +3124,8 @@ static void nvme_remove(struct pci_dev *pdev)
        flush_work(&dev->reset_work);
        flush_work(&dev->scan_work);
        device_remove_file(dev->device, &dev_attr_reset_controller);
-       nvme_dev_shutdown(dev);
        nvme_dev_remove(dev);
+       nvme_dev_shutdown(dev);
        nvme_dev_remove_admin(dev);
        device_destroy(nvme_class, MKDEV(nvme_char_major, dev->instance));
        nvme_free_queues(dev, 0);