From: Mike Christie Date: Wed, 3 May 2017 04:57:05 +0000 (-0500) Subject: tcmu: fix module removal due to stuck thread X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d906d8af28e524bfa62c49cb2315f6ccdb910938;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git tcmu: fix module removal due to stuck thread We need to do a kthread_should_stop to check when kthread_stop has been called. This was a regression added in b6df4b79a5514a9c6c53533436704129ef45bf76 tcmu: Add global data block pool support so not sure if you wanted to merge it in with that patch or what. Signed-off-by: Mike Christie Signed-off-by: Nicholas Bellinger --- diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 89b75ce563d8..9045837f748b 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -1560,6 +1560,9 @@ static int unmap_thread_fn(void *data) schedule(); finish_wait(&unmap_wait, &__wait); + if (kthread_should_stop()) + break; + mutex_lock(&root_udev_mutex); list_for_each_entry(udev, &root_udev, node) { mutex_lock(&udev->cmdr_lock);