rcu: Make rcu_assign_pointer's assignment volatile and type-safe

The rcu_assign_pointer() primitive needs to use ACCESS_ONCE to make
the assignment to the destination pointer volatile, to protect against
compilers too clever for their own good.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
Josh Triplett 2013-09-01 16:42:52 -07:00 committed by Paul E. McKenney
parent 36708b89e0
commit 9d162cd063

View file

@ -551,7 +551,7 @@ static inline void rcu_preempt_sleep_check(void)
#define __rcu_assign_pointer(p, v, space) \
do { \
smp_wmb(); \
(p) = (typeof(*v) __force space *)(v); \
ACCESS_ONCE(p) = (typeof(*(v)) __force space *)(v); \
} while (0)