Re: [PATCH] Fix deadlock in __create_workqueue

From: Srivatsa Vaddagiri
Date: Tue May 04 2004 - 01:52:03 EST


On Mon, May 03, 2004 at 01:08:29PM -0700, Andrew Morton wrote:
> yup, sorry, I misread the code. Like this?

Yes, looks fine to me!

>
> --- 25/kernel/workqueue.c~worker_thread-race-fix Mon May 3 13:02:25 2004
> +++ 25-akpm/kernel/workqueue.c Mon May 3 13:07:34 2004
> @@ -201,19 +201,20 @@ static int worker_thread(void *__cwq)
> siginitset(&sa.sa.sa_mask, sigmask(SIGCHLD));
> do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);
>
> + set_current_state(TASK_INTERRUPTIBLE);
> while (!kthread_should_stop()) {
> - set_task_state(current, TASK_INTERRUPTIBLE);
> -
> add_wait_queue(&cwq->more_work, &wait);
> if (list_empty(&cwq->worklist))
> schedule();
> else
> - set_task_state(current, TASK_RUNNING);
> + __set_current_state(TASK_RUNNING);
> remove_wait_queue(&cwq->more_work, &wait);
>
> if (!list_empty(&cwq->worklist))
> run_workqueue(cwq);
> + set_current_state(TASK_INTERRUPTIBLE);
> }
> + __set_current_state(TASK_RUNNING);
> return 0;
> }

--


Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/