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:56:33 +0000 (15:56 -0400)
commit3c29ca5d56988c3a10ba289a1129eadb4bf6b3ee
tree3ae4feccef15bf431650009ce571a974ab970ad9
parent65e14860489c5f903bbf5f6bd2d538e836cb5717
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.025283 seconds and 4 git commands to generate.