Thomas Tuttle fa2563e41c workqueue: lock cwq access in drain_workqueue
Take cwq->gcwq->lock to avoid racing between drain_workqueue checking to
make sure the workqueues are empty and cwq_dec_nr_in_flight decrementing
and then incrementing nr_active when it activates a delayed work.

We discovered this when a corner case in one of our drivers resulted in
us trying to destroy a workqueue in which the remaining work would
always requeue itself again in the same workqueue.  We would hit this
race condition and trip the BUG_ON on workqueue.c:3080.

Signed-off-by: Thomas Tuttle <ttuttle@chromium.org>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-14 18:09:38 -07:00
..
2011-07-26 16:49:45 -07:00
2010-08-09 16:48:42 -04:00
2011-03-14 09:15:23 -04:00
2011-07-26 16:49:47 -07:00
2010-10-30 01:42:19 -04:00
2011-07-26 16:49:47 -07:00
2011-05-19 18:51:57 +10:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:47 -07:00
2011-07-14 12:59:14 +03:00
2011-07-26 16:49:44 -07:00
2011-05-17 23:19:17 +02:00
2011-08-04 09:09:27 +02:00
2010-10-01 10:50:58 -07:00
2011-08-03 22:03:29 -10:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:45 -07:00
2011-05-24 12:10:51 +02:00
2011-07-26 16:49:47 -07:00
2011-05-20 12:50:29 -07:00
2011-07-26 16:49:47 -07:00
2011-07-26 16:49:47 -07:00
2011-07-30 21:21:39 +02:00
2011-07-26 16:49:47 -07:00
2011-03-31 11:26:23 -03:00
2011-04-24 13:18:38 +02:00
2011-07-26 16:49:47 -07:00
2011-08-12 16:21:35 -05:00
2011-08-12 16:21:35 -05:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00