workqueue: ensure attrs changes are properly synchronized
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 19 May 2015 10:03:48 +0000 (18:03 +0800)
committerTejun Heo <tj@kernel.org>
Tue, 19 May 2015 21:37:00 +0000 (17:37 -0400)
commitd4d3e2579756e3a5f4fbf8eac211f0696e253bcd
treeb6d880e578cd07db0d60a8dee86c28d67abb446c
parenta0111cf6710bd1b4145ef313d3f4772602af051b
workqueue: ensure attrs changes are properly synchronized

Current modification to attrs via sysfs is not fully synchronized.

Process A (change cpumask)      | Process B (change numa affinity)
wq_cpumask_store()              |
  wq_sysfs_prep_attrs()         |
                                | apply_workqueue_attrs()
  apply_workqueue_attrs()       |

It results that the Process B's operation is totally reverted
without any notification, it is a buggy behavior.  So this patch
moves wq_sysfs_prep_attrs() into the protection under wq_pool_mutex
to ensure attrs changes are properly synchronized.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c