]> git.karo-electronics.de Git - karo-tx-linux.git/commit
workqueue: add missing smp_wmb() in process_one_work()
authorTejun Heo <tj@kernel.org>
Fri, 3 Aug 2012 17:30:45 +0000 (10:30 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 17 Oct 2012 02:48:09 +0000 (03:48 +0100)
commit563ce0476bddbd8e9818c3c7088186dd01479ffe
tree0c763d9c2985e388f1992f93afb1d5b6c639237a
parentb05d6bcb7e538370b7a4d3c8b3552be60f1fbb8d
workqueue: add missing smp_wmb() in process_one_work()

commit 959d1af8cffc8fd38ed53e8be1cf4ab8782f9c00 upstream.

WORK_STRUCT_PENDING is used to claim ownership of a work item and
process_one_work() releases it before starting execution.  When
someone else grabs PENDING, all pre-release updates to the work item
should be visible and all updates made by the new owner should happen
afterwards.

Grabbing PENDING uses test_and_set_bit() and thus has a full barrier;
however, clearing doesn't have a matching wmb.  Given the preceding
spin_unlock and use of clear_bit, I don't believe this can be a
problem on an actual machine and there hasn't been any related report
but it still is theretically possible for clear_pending to permeate
upwards and happen before work->entry update.

Add an explicit smp_wmb() before work_clear_pending().

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
kernel/workqueue.c