From: Sagi Grimberg Date: Sun, 1 Jan 2017 11:41:56 +0000 (+0200) Subject: nvmet: cancel fatal error and flush async work before free controller X-Git-Tag: MMI-PSA29.97-13-9~6221^2~4^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=06406d81a2d7cfb8abcc4fa6cdfeb8e5897007c5;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Signed-off-by: Sagi Grimberg Reviewed-by: Christoph Hellwig --- 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);