Commit 4d595b8
workqueue: make rescuer_thread() empty wq->maydays list before exiting
After a @pwq is scheduled for emergency execution, other workers may
consume the affectd work items before the rescuer gets to them. This
means that a workqueue many have pwqs queued on @wq->maydays list
while not having any work item pending or in-flight. If
destroy_workqueue() executes in such condition, the rescuer may exit
without emptying @wq->maydays.
This currently doesn't cause any actual harm. destroy_workqueue() can
safely destroy all the involved data structures whether @wq->maydays
is populated or not as nobody access the list once the rescuer exits.
However, this is nasty and makes future development difficult. Let's
update rescuer_thread() so that it empties @wq->maydays after seeing
should_stop to guarantee that the list is empty on rescuer exit.
tj: Updated comment and patch description.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org # v3.10+1 parent 77f300b commit 4d595b8
1 file changed
+16
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2398 | 2398 | | |
2399 | 2399 | | |
2400 | 2400 | | |
| 2401 | + | |
2401 | 2402 | | |
2402 | 2403 | | |
2403 | 2404 | | |
| |||
2409 | 2410 | | |
2410 | 2411 | | |
2411 | 2412 | | |
2412 | | - | |
2413 | | - | |
2414 | | - | |
2415 | | - | |
2416 | | - | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
2417 | 2422 | | |
2418 | 2423 | | |
2419 | 2424 | | |
| |||
2459 | 2464 | | |
2460 | 2465 | | |
2461 | 2466 | | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
2462 | 2473 | | |
2463 | 2474 | | |
2464 | 2475 | | |
| |||
0 commit comments