mirror of https://gitee.com/openkylin/linux.git
NVMe: Fix filesystem sync deadlock on removal
This changes the order of deleting the gendisks so it happens after the nvme IO queues are freed. If a device is removed while a filesystem has associated dirty data, the removal will wait on these to complete before proceeding from del_gendisk, which could have caused deadlock before. The implication of this is that an orderly removal of a responsive device won't necessarily wait for dirty data to be written, but we are not guaranteed the device is even going to respond at this point either. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
f435c2825b
commit
302c6727e5
|
@ -2781,8 +2781,8 @@ static void nvme_remove_disks(struct work_struct *ws)
|
||||||
{
|
{
|
||||||
struct nvme_dev *dev = container_of(ws, struct nvme_dev, reset_work);
|
struct nvme_dev *dev = container_of(ws, struct nvme_dev, reset_work);
|
||||||
|
|
||||||
nvme_dev_remove(dev);
|
|
||||||
nvme_free_queues(dev, 1);
|
nvme_free_queues(dev, 1);
|
||||||
|
nvme_dev_remove(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nvme_dev_resume(struct nvme_dev *dev)
|
static int nvme_dev_resume(struct nvme_dev *dev)
|
||||||
|
@ -2931,9 +2931,9 @@ static void nvme_remove(struct pci_dev *pdev)
|
||||||
flush_work(&dev->reset_work);
|
flush_work(&dev->reset_work);
|
||||||
flush_work(&dev->cpu_work);
|
flush_work(&dev->cpu_work);
|
||||||
misc_deregister(&dev->miscdev);
|
misc_deregister(&dev->miscdev);
|
||||||
nvme_dev_remove(dev);
|
|
||||||
nvme_dev_shutdown(dev);
|
nvme_dev_shutdown(dev);
|
||||||
nvme_free_queues(dev, 0);
|
nvme_free_queues(dev, 0);
|
||||||
|
nvme_dev_remove(dev);
|
||||||
nvme_release_instance(dev);
|
nvme_release_instance(dev);
|
||||||
nvme_release_prp_pools(dev);
|
nvme_release_prp_pools(dev);
|
||||||
kref_put(&dev->kref, nvme_free_dev);
|
kref_put(&dev->kref, nvme_free_dev);
|
||||||
|
|
Loading…
Reference in New Issue