tcmu: Fix module removal due to stuck unmap_thread thread again
authorXiubo Li <lixiubo@cmss.chinamobile.com>
Thu, 15 Jun 2017 07:05:31 +0000 (15:05 +0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 7 Jul 2017 06:11:33 +0000 (23:11 -0700)
Because the unmap code just after the schdule() returned may take
a long time and if the kthread_stop() is fired just when in this
routine, the module removal maybe stuck too.

Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_user.c

index afc1fd6..a60a66d 100644 (file)
@@ -1707,7 +1707,7 @@ static int unmap_thread_fn(void *data)
        struct page *page;
        int i;
 
-       while (1) {
+       while (!kthread_should_stop()) {
                DEFINE_WAIT(__wait);
 
                prepare_to_wait(&unmap_wait, &__wait, TASK_INTERRUPTIBLE);