diff options
author | Ying Xue <ying.xue@windriver.com> | 2014-05-04 20:56:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-05 17:26:44 -0400 |
commit | 9db9fdd1983eb960182d72f95d77b91b3a5173d0 (patch) | |
tree | 0c4d21174478529972f3b630f7b1daa6f018f134 /net/tipc/node.c | |
parent | 10f465c4966fbc8f50a59480d37a3451f6f3d564 (diff) |
tipc: avoid to asynchronously notify subscriptions
Postpone the actions of notifying subscriptions until after node lock
is released, avoiding to asynchronously execute registered handlers
when node is lost.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r-- | net/tipc/node.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index 2b0a0849d4cc..befbcc9eade6 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -321,10 +321,10 @@ static void node_lost_contact(struct tipc_node *n_ptr) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | /* Notify subscribers */ | 323 | /* Notify subscribers */ |
324 | tipc_nodesub_notify(n_ptr); | 324 | n_ptr->flags = TIPC_NODE_LOST; |
325 | 325 | ||
326 | /* Prevent re-contact with node until cleanup is done */ | 326 | /* Prevent re-contact with node until cleanup is done */ |
327 | n_ptr->flags = TIPC_NODE_DOWN | TIPC_NAMES_GONE; | 327 | n_ptr->flags |= TIPC_NODE_DOWN | TIPC_NAMES_GONE; |
328 | tipc_k_signal((Handler)node_name_purge_complete, n_ptr->addr); | 328 | tipc_k_signal((Handler)node_name_purge_complete, n_ptr->addr); |
329 | } | 329 | } |
330 | 330 | ||
@@ -465,3 +465,22 @@ int tipc_node_get_linkname(u32 bearer_id, u32 addr, char *linkname, size_t len) | |||
465 | tipc_node_unlock(node); | 465 | tipc_node_unlock(node); |
466 | return -EINVAL; | 466 | return -EINVAL; |
467 | } | 467 | } |
468 | |||
469 | void tipc_node_unlock(struct tipc_node *node) | ||
470 | { | ||
471 | LIST_HEAD(nsub_list); | ||
472 | |||
473 | if (likely(!node->flags)) { | ||
474 | spin_unlock_bh(&node->lock); | ||
475 | return; | ||
476 | } | ||
477 | |||
478 | if (node->flags & TIPC_NODE_LOST) { | ||
479 | list_replace_init(&node->nsub, &nsub_list); | ||
480 | node->flags &= ~TIPC_NODE_LOST; | ||
481 | } | ||
482 | spin_unlock_bh(&node->lock); | ||
483 | |||
484 | if (!list_empty(&nsub_list)) | ||
485 | tipc_nodesub_notify(&nsub_list); | ||
486 | } | ||