From 5ab0fec5e715dd22e9d30d9f2eb1f0bbb05fb001 Mon Sep 17 00:00:00 2001 From: Simon Kagstrom Date: Fri, 12 Feb 2010 17:40:37 +0900 Subject: workqueue: return on workqueue recursion When the workqueue is flushed from workqueue context (recursively), the system enters a strange state where things at random (dependent on the global workqueue) start misbehaving. For example, for us the console and logins locks up while the web server continues running. The system becomes unstable since the workqueue barrier locks the workqueue. This patch instead returns if the workqueue is flushed recursively, which keeps the workqueue alive but warns. Signed-off-by: Simon Kagstrom Signed-off-by: Tejun Heo --- kernel/workqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 2f9d5f9b44cf..b156dd6c87f3 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -482,7 +482,8 @@ static int flush_cpu_workqueue(struct cpu_workqueue_struct *cwq) int active = 0; struct wq_barrier barr; - WARN_ON(cwq->thread == current); + if (WARN_ON(cwq->thread == current)) + return 1; spin_lock_irq(&cwq->lock); if (!list_empty(&cwq->worklist) || cwq->current_work != NULL) { -- cgit v1.2.3