summaryrefslogtreecommitdiffstats
path: root/drivers/nvme
diff options
context:
space:
mode:
authorSagi Grimberg <sagi@grimberg.me>2017-01-01 13:41:56 +0200
committerSagi Grimberg <sagi@grimberg.me>2017-01-26 17:45:00 +0200
commit06406d81a2d7cfb8abcc4fa6cdfeb8e5897007c5 (patch)
tree44710470ec93fd7b8400139ff1a33490d6335525 /drivers/nvme
parent344770b07b7ae70639ebf110010eb6156a6e55e9 (diff)
downloadlinux-06406d81a2d7cfb8abcc4fa6cdfeb8e5897007c5.tar.bz2
nvmet: cancel fatal error and flush async work before free controller
Make sure they are not running and we can free the controller safely. Signed-off-by: Roy Shterman <roys@lightbitslabs.com> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/target/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 4a367549eb93..a327a43f8166 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -816,6 +816,9 @@ static void nvmet_ctrl_free(struct kref *ref)
list_del(&ctrl->subsys_entry);
mutex_unlock(&subsys->lock);
+ flush_work(&ctrl->async_event_work);
+ cancel_work_sync(&ctrl->fatal_err_work);
+
ida_simple_remove(&subsys->cntlid_ida, ctrl->cntlid);
nvmet_subsys_put(subsys);