diff options
Diffstat (limited to 'net/tipc/node.c')
| -rw-r--r-- | net/tipc/node.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index b634942caba5..7c49cd056df7 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
| @@ -237,23 +237,22 @@ void tipc_node_link_down(struct tipc_node *n_ptr, struct link *l_ptr) | |||
| 237 | 237 | ||
| 238 | int tipc_node_has_active_links(struct tipc_node *n_ptr) | 238 | int tipc_node_has_active_links(struct tipc_node *n_ptr) |
| 239 | { | 239 | { |
| 240 | return (n_ptr && | 240 | return n_ptr->active_links[0] != NULL; |
| 241 | ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); | ||
| 242 | } | 241 | } |
| 243 | 242 | ||
| 244 | int tipc_node_has_redundant_links(struct tipc_node *n_ptr) | 243 | int tipc_node_has_redundant_links(struct tipc_node *n_ptr) |
| 245 | { | 244 | { |
| 246 | return (n_ptr->working_links > 1); | 245 | return n_ptr->working_links > 1; |
| 247 | } | 246 | } |
| 248 | 247 | ||
| 249 | static int tipc_node_has_active_routes(struct tipc_node *n_ptr) | 248 | static int tipc_node_has_active_routes(struct tipc_node *n_ptr) |
| 250 | { | 249 | { |
| 251 | return (n_ptr && (n_ptr->last_router >= 0)); | 250 | return n_ptr && (n_ptr->last_router >= 0); |
| 252 | } | 251 | } |
| 253 | 252 | ||
| 254 | int tipc_node_is_up(struct tipc_node *n_ptr) | 253 | int tipc_node_is_up(struct tipc_node *n_ptr) |
| 255 | { | 254 | { |
| 256 | return (tipc_node_has_active_links(n_ptr) || tipc_node_has_active_routes(n_ptr)); | 255 | return tipc_node_has_active_links(n_ptr) || tipc_node_has_active_routes(n_ptr); |
| 257 | } | 256 | } |
| 258 | 257 | ||
| 259 | struct tipc_node *tipc_node_attach_link(struct link *l_ptr) | 258 | struct tipc_node *tipc_node_attach_link(struct link *l_ptr) |
| @@ -384,6 +383,20 @@ static void node_established_contact(struct tipc_node *n_ptr) | |||
| 384 | tipc_highest_allowed_slave); | 383 | tipc_highest_allowed_slave); |
| 385 | } | 384 | } |
| 386 | 385 | ||
| 386 | static void node_cleanup_finished(unsigned long node_addr) | ||
| 387 | { | ||
| 388 | struct tipc_node *n_ptr; | ||
| 389 | |||
| 390 | read_lock_bh(&tipc_net_lock); | ||
| 391 | n_ptr = tipc_node_find(node_addr); | ||
| 392 | if (n_ptr) { | ||
| 393 | tipc_node_lock(n_ptr); | ||
| 394 | n_ptr->cleanup_required = 0; | ||
| 395 | tipc_node_unlock(n_ptr); | ||
| 396 | } | ||
| 397 | read_unlock_bh(&tipc_net_lock); | ||
| 398 | } | ||
| 399 | |||
| 387 | static void node_lost_contact(struct tipc_node *n_ptr) | 400 | static void node_lost_contact(struct tipc_node *n_ptr) |
| 388 | { | 401 | { |
| 389 | struct cluster *c_ptr; | 402 | struct cluster *c_ptr; |
| @@ -458,6 +471,11 @@ static void node_lost_contact(struct tipc_node *n_ptr) | |||
| 458 | tipc_k_signal((Handler)ns->handle_node_down, | 471 | tipc_k_signal((Handler)ns->handle_node_down, |
| 459 | (unsigned long)ns->usr_handle); | 472 | (unsigned long)ns->usr_handle); |
| 460 | } | 473 | } |
| 474 | |||
| 475 | /* Prevent re-contact with node until all cleanup is done */ | ||
| 476 | |||
| 477 | n_ptr->cleanup_required = 1; | ||
| 478 | tipc_k_signal((Handler)node_cleanup_finished, n_ptr->addr); | ||
| 461 | } | 479 | } |
| 462 | 480 | ||
| 463 | /** | 481 | /** |
