The shutdown code in
d79d57e and
b20e160 had a race condition during
shutdown, due to not owning a reference on the associated task_struct
while the associated threads shut themselves down.
Patch over this by taking an appropriate reference.
Signed-off-by: Justin Husted <sigstop@gmail.com>
{
struct task_struct *p = NULL;
swap(aio_task, p);
+ get_task_struct(p);
atomic_set(&aio_thread_stop, 1);
ret = kthread_stop(p);
BUG_ON(ret);
+ put_task_struct(p);
+
close(fds[0]);
close(fds[1]);
}
__attribute__((destructor(103)))
static void timers_cleanup(void)
{
+ get_task_struct(timer_task);
+
pthread_mutex_lock(&timer_lock);
timer_thread_stop = true;
pthread_cond_signal(&timer_cond);
int ret = kthread_stop(timer_task);
BUG_ON(ret);
+ put_task_struct(timer_task);
timer_task = NULL;
}