summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Kagstrom <simon.kagstrom@netinsight.net>2010-02-12 17:40:37 +0900
committerTejun Heo <tj@kernel.org>2010-02-12 17:42:47 +0900
commit5ab0fec5e715dd22e9d30d9f2eb1f0bbb05fb001 (patch)
tree8418f304f83768125992f8bd7cd3478de9de4f88
parent05a8c03c8684c208f960b513d19d1874c17002eb (diff)
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 <simon.kagstrom@netinsight.net> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--kernel/workqueue.c3
1 files changed, 2 insertions, 1 deletions
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) {