diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2015-10-15 14:52:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-16 02:55:23 -0400 |
commit | c819930090fe3f74c822be765c185b3431360193 (patch) | |
tree | 8f79b62d957d1b0d209cb3a3aa3f2abe163d226a /net/tipc/node.c | |
parent | 282b3a056225b35024246f63feb91d769d714dad (diff) |
tipc: update node FSM when peer RESET message is received
The change made in the previous commit revealed a small flaw in the way
the node FSM is updated. When the function tipc_node_link_down() is
called for the last link to a node, we should check whether this was
caused by a local reset or by a received RESET message from the peer.
In the latter case, we can directly issue a PEER_LOST_CONTACT_EVT to
the node FSM, so that it is ready to re-establish contact. If this is
not done, the peer node will sometimes have to go through a second
establish cycle before the link becomes stable.
We fix this in this commit by conditionally issuing the mentioned
event in the function tipc_node_link_down(). We also move LINK_RESET
FSM even away from the link_reset() function and into the caller
function, partially because it is easier to follow the code when state
changes are gathered at a limited number of locations, partially
because there will be cases in future commits where we don't want the
link to go RESET mode when link_reset() is called.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r-- | net/tipc/node.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index fba6e1af28e8..d1f340116c84 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "socket.h" | 41 | #include "socket.h" |
42 | #include "bcast.h" | 42 | #include "bcast.h" |
43 | #include "discover.h" | 43 | #include "discover.h" |
44 | #define pr_debug printk | 44 | |
45 | /* Node FSM states and events: | 45 | /* Node FSM states and events: |
46 | */ | 46 | */ |
47 | enum { | 47 | enum { |
@@ -420,6 +420,10 @@ static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id, | |||
420 | } | 420 | } |
421 | 421 | ||
422 | if (!tipc_node_is_up(n)) { | 422 | if (!tipc_node_is_up(n)) { |
423 | if (tipc_link_peer_is_down(l)) | ||
424 | tipc_node_fsm_evt(n, PEER_LOST_CONTACT_EVT); | ||
425 | tipc_node_fsm_evt(n, SELF_LOST_CONTACT_EVT); | ||
426 | tipc_link_fsm_evt(l, LINK_RESET_EVT); | ||
423 | tipc_link_reset(l); | 427 | tipc_link_reset(l); |
424 | tipc_link_build_reset_msg(l, xmitq); | 428 | tipc_link_build_reset_msg(l, xmitq); |
425 | *maddr = &n->links[*bearer_id].maddr; | 429 | *maddr = &n->links[*bearer_id].maddr; |
@@ -434,6 +438,7 @@ static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id, | |||
434 | n->sync_point = tnl->rcv_nxt + (U16_MAX / 2 - 1); | 438 | n->sync_point = tnl->rcv_nxt + (U16_MAX / 2 - 1); |
435 | tipc_link_tnl_prepare(l, tnl, FAILOVER_MSG, xmitq); | 439 | tipc_link_tnl_prepare(l, tnl, FAILOVER_MSG, xmitq); |
436 | tipc_link_reset(l); | 440 | tipc_link_reset(l); |
441 | tipc_link_fsm_evt(l, LINK_RESET_EVT); | ||
437 | tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT); | 442 | tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT); |
438 | tipc_node_fsm_evt(n, NODE_FAILOVER_BEGIN_EVT); | 443 | tipc_node_fsm_evt(n, NODE_FAILOVER_BEGIN_EVT); |
439 | *maddr = &n->links[tnl->bearer_id].maddr; | 444 | *maddr = &n->links[tnl->bearer_id].maddr; |
@@ -581,6 +586,7 @@ void tipc_node_check_dest(struct net *net, u32 onode, | |||
581 | goto exit; | 586 | goto exit; |
582 | } | 587 | } |
583 | tipc_link_reset(l); | 588 | tipc_link_reset(l); |
589 | tipc_link_fsm_evt(l, LINK_RESET_EVT); | ||
584 | if (n->state == NODE_FAILINGOVER) | 590 | if (n->state == NODE_FAILINGOVER) |
585 | tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT); | 591 | tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT); |
586 | le->link = l; | 592 | le->link = l; |
@@ -863,9 +869,6 @@ static void node_lost_contact(struct tipc_node *n_ptr, | |||
863 | tipc_link_fsm_evt(l, LINK_FAILOVER_END_EVT); | 869 | tipc_link_fsm_evt(l, LINK_FAILOVER_END_EVT); |
864 | } | 870 | } |
865 | 871 | ||
866 | /* Prevent re-contact with node until cleanup is done */ | ||
867 | tipc_node_fsm_evt(n_ptr, SELF_LOST_CONTACT_EVT); | ||
868 | |||
869 | /* Notify publications from this node */ | 872 | /* Notify publications from this node */ |
870 | n_ptr->action_flags |= TIPC_NOTIFY_NODE_DOWN; | 873 | n_ptr->action_flags |= TIPC_NOTIFY_NODE_DOWN; |
871 | 874 | ||