lib/ovs-rcu: Evaluate parameters before ovsrcu_set.
authorJarno Rajahalme <jrajahalme@nicira.com>
Tue, 3 Jun 2014 15:35:16 +0000 (08:35 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Tue, 3 Jun 2014 15:48:33 +0000 (08:48 -0700)
commit51136eb445d6f09b42885bc521454623e44a7154
treec89664678394b16e9046bf97b9a786050be70951
parent36e9fe9c7b5b278ac07c71676e318d9120967920
lib/ovs-rcu: Evaluate parameters before ovsrcu_set.

ovsrcu_set() looks like a function, so users are justified in expecting
the arguments to be evaluated before any of the body of ovsrcu_set().

With ovs-atomic-pthreads, a fallback ovs-atomics implementation used
when no C11 atomics are available or with GCC older than 4.0, the
prior definitions led to nested mutex locking when the 'VALUE'
argument was an atomic_read().  This is resolved by ensuring function
argument semantics for the parameters.  For non-GCC compilers this is
done with an inline function.  GCC implementation of ovs-rcu does not
fix the RCU variable type, so a GCC macro needs to be used instead.

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
lib/ovs-rcu.h