]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: move the delivery of named messages out of nametbl lock
authorYing Xue <ying.xue@windriver.com>
Mon, 28 Apr 2014 10:00:10 +0000 (18:00 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Apr 2014 18:49:54 +0000 (14:49 -0400)
commit2421c37eed65ef5422651bcaba3d497e5877d789
tree8bd9c3e5aaee575abef950d992e92511bdc5f2b8
parent22530427eb7355fe899d862707518d52533b1e3c
tipc: move the delivery of named messages out of nametbl lock

Commit e49abf29d7bee54767e77b151b18aa3470d319e5 ("tipc: add support
for link state subscriptions") introduced below possible deadlock
scenario:

       CPU0                          CPU1
T0:   tipc_publish()                 link_timeout()
T1:   tipc_nametbl_publish()         [grab node lock]*
T2:   [grab nametbl write lock]*     link_state_event()
T3:   named_cluster_distribute()     link_activate()
T4:   [grab node lock]*              tipc_node_link_up()
T5:                                  tipc_nametbl_publish()
T6:                                  [grab nametble write lock]*

The opposite order of holding nametbl write lock and node lock on
above two different paths may result in a deadlock. If we move the
the delivery of named messages via link out of name nametbl lock,
the reverse order of holding locks will be eliminated, as a result,
the deadlock will be killed as well.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/name_distr.c
net/tipc/name_distr.h
net/tipc/name_table.c