Fix: deadlock when thread join is issued in read-side C.S.
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 23 Apr 2015 18:00:23 +0000 (14:00 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 25 Apr 2015 19:55:55 +0000 (15:55 -0400)
commit66bc4dcd6d823e527395bac6755c17718c3f8e71
treeb0476518a0813e3fcd8173ebe09b8bdcaec4626d
parente824a59e2145383fffb648565209ce743990903b
Fix: deadlock when thread join is issued in read-side C.S.

The transitive dependency between:

RCU read-side C.S. -> synchronize_rcu -> rcu_gp_lock -> rcu_register_thread

and the dependency:

pthread_join -> awaiting for thread completion

Can block a thread on join, and thus have the side-effect of deadlocking
a thread doing a pthread_join while within a RCU read-side critical
section. This join would be awaiting for completion of register_thread or
rcu_unregister_thread, which may never complete because the rcu_gp_lock
is held by synchronize_rcu executed from another thread.

One solution to fix this is to add a new lock, rcu_registry_lock. This
lock now protects the thread registry. It is released between iterations
on the registry by synchronize_rcu, thus allowing thread
registration/unregistration to complete even though synchronize_rcu is
awaiting for RCU read-side critical sections to complete.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
CC: Eugene Ivanov <Eugene.Ivanov@orc-group.com>
CC: Lai Jiangshan <laijs@cn.fujitsu.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
urcu-bp.c
urcu-qsbr.c
urcu.c
This page took 0.026313 seconds and 4 git commands to generate.