nvme: flush reset_work before safely continuing with delete operation
authorSagi Grimberg <sagi@grimberg.me>
Sun, 29 Oct 2017 12:21:02 +0000 (14:21 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 1 Nov 2017 15:28:17 +0000 (16:28 +0100)
Prevent racing controller reset and delete flows. reset_work must not
ever self-requeue so flushing it suffices.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c
drivers/nvme/host/fc.c

index 4fa748c9a3f6de3c98dfaa02f65c366ed3d19eb2..003314eb6341ad205fc505190219bded9f1376d1 100644 (file)
@@ -102,6 +102,7 @@ static void nvme_delete_ctrl_work(struct work_struct *work)
        struct nvme_ctrl *ctrl =
                container_of(work, struct nvme_ctrl, delete_work);
 
+       flush_work(&ctrl->reset_work);
        nvme_stop_ctrl(ctrl);
        nvme_remove_namespaces(ctrl);
        ctrl->ops->delete_ctrl(ctrl);
index e447b532b9ee85f2ffb847bec435dabd0092b3ed..6a025a8d8c32c51958f54ab0c8a503ce0ebe6d48 100644 (file)
@@ -2638,7 +2638,6 @@ nvme_fc_delete_ctrl(struct nvme_ctrl *nctrl)
 {
        struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl);
 
-       cancel_work_sync(&ctrl->ctrl.reset_work);
        cancel_delayed_work_sync(&ctrl->connect_work);
        /*
         * kill the association on the link side.  this will block