On Fri, Aug 27, 2010 at 06:17:36PM +0200, Artem.Bityutskiy@xxxxxxxxx wrote: > I need to look more. But so far I do not really understand what could make kthread_stop() wait > forever. I looked into the code, and thought may be barriers are missing there, but I is unlikely > this generic type of code would have bugs. Hm, is the way you go to sleep in the writeback thread safe? Surely there's a race like: while(!kthread_should_stop()) { kthread_stop(): kthread->should_stop = 1; wake_up_process(k); wait_for_completion(&kthread->exited); /* oops, lose the wake_up here: */ set_current_state(TASK_INTERRUPTIBLE); ... /* sleep forever: */ schedule(); Maybe the following? --b. diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 7d9d06b..ea76550 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -808,7 +808,7 @@ int bdi_writeback_thread(void *data) wb->last_active = jiffies; set_current_state(TASK_INTERRUPTIBLE); - if (!list_empty(&bdi->work_list)) { + if (!list_empty(&bdi->work_list) || kthread_should_stop()) { __set_current_state(TASK_RUNNING); continue; } -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html