|
@@ -1851,6 +1851,12 @@ static void destroy_worker(struct worker *worker)
|
|
if (worker->flags & WORKER_IDLE)
|
|
if (worker->flags & WORKER_IDLE)
|
|
pool->nr_idle--;
|
|
pool->nr_idle--;
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Once WORKER_DIE is set, the kworker may destroy itself at any
|
|
|
|
+ * point. Pin to ensure the task stays until we're done with it.
|
|
|
|
+ */
|
|
|
|
+ get_task_struct(worker->task);
|
|
|
|
+
|
|
list_del_init(&worker->entry);
|
|
list_del_init(&worker->entry);
|
|
worker->flags |= WORKER_DIE;
|
|
worker->flags |= WORKER_DIE;
|
|
|
|
|
|
@@ -1859,6 +1865,7 @@ static void destroy_worker(struct worker *worker)
|
|
spin_unlock_irq(&pool->lock);
|
|
spin_unlock_irq(&pool->lock);
|
|
|
|
|
|
kthread_stop(worker->task);
|
|
kthread_stop(worker->task);
|
|
|
|
+ put_task_struct(worker->task);
|
|
kfree(worker);
|
|
kfree(worker);
|
|
|
|
|
|
spin_lock_irq(&pool->lock);
|
|
spin_lock_irq(&pool->lock);
|