Skip to content

Commit c0b14a0

Browse files
Tuong Liendavem330
authored andcommitted
tipc: fix missing Name entries due to half-failover
TIPC link can temporarily fall into "half-establish" that only one of the link endpoints is ESTABLISHED and starts to send traffic, PROTOCOL messages, whereas the other link endpoint is not up (e.g. immediately when the endpoint receives ACTIVATE_MSG, the network interface goes down...). This is a normal situation and will be settled because the link endpoint will be eventually brought down after the link tolerance time. However, the situation will become worse when the second link is established before the first link endpoint goes down, For example: 1. Both links <1A-2A>, <1B-2B> down 2. Link endpoint 2A up, but 1A still down (e.g. due to network disturbance, wrong session, etc.) 3. Link <1B-2B> up 4. Link endpoint 2A down (e.g. due to link tolerance timeout) 5. Node B starts failover onto link <1B-2B> ==> Node A does never start link failover. When the "half-failover" situation happens, two consequences have been observed: a) Peer link/node gets stuck in FAILINGOVER state; b) Traffic or user messages that peer node is trying to failover onto the second link can be partially or completely dropped by this node. The consequence a) was actually solved by commit c140eb1 ("tipc: fix failover problem"), but that commit didn't cover the b). It's due to the fact that the tunnel link endpoint has never been prepared for a failover, so the 'l->drop_point' (and the other data...) is not set correctly. When a TUNNEL_MSG from peer node arrives on the link, depending on the inner message's seqno and the current 'l->drop_point' value, the message can be dropped (- treated as a duplicate message) or processed. At this early stage, the traffic messages from peer are likely to be NAME_DISTRIBUTORs, this means some name table entries will be missed on the node forever! The commit resolves the issue by starting the FAILOVER process on this node as well. Another benefit from this solution is that we ensure the link will not be re-established until the failover ends. Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f24098f commit c0b14a0

3 files changed

Lines changed: 84 additions & 7 deletions

File tree

‎net/tipc/link.c‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,41 @@ void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
17051705
}
17061706
}
17071707

1708+
/**
1709+
* tipc_link_failover_prepare() - prepare tnl for link failover
1710+
*
1711+
* This is a special version of the precursor - tipc_link_tnl_prepare(),
1712+
* see the tipc_node_link_failover() for details
1713+
*
1714+
* @l: failover link
1715+
* @tnl: tunnel link
1716+
* @xmitq: queue for messages to be xmited
1717+
*/
1718+
void tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl,
1719+
struct sk_buff_head *xmitq)
1720+
{
1721+
struct sk_buff_head *fdefq = &tnl->failover_deferdq;
1722+
1723+
tipc_link_create_dummy_tnl_msg(tnl, xmitq);
1724+
1725+
/* This failover link enpoint was never established before,
1726+
* so it has not received anything from peer.
1727+
* Otherwise, it must be a normal failover situation or the
1728+
* node has entered SELF_DOWN_PEER_LEAVING and both peer nodes
1729+
* would have to start over from scratch instead.
1730+
*/
1731+
WARN_ON(l && tipc_link_is_up(l));
1732+
tnl->drop_point = 1;
1733+
tnl->failover_reasm_skb = NULL;
1734+
1735+
/* Initiate the link's failover deferdq */
1736+
if (unlikely(!skb_queue_empty(fdefq))) {
1737+
pr_warn("Link failover deferdq not empty: %d!\n",
1738+
skb_queue_len(fdefq));
1739+
__skb_queue_purge(fdefq);
1740+
}
1741+
}
1742+
17081743
/* tipc_link_validate_msg(): validate message against current link state
17091744
* Returns true if message should be accepted, otherwise false
17101745
*/

‎net/tipc/link.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
9090
int mtyp, struct sk_buff_head *xmitq);
9191
void tipc_link_create_dummy_tnl_msg(struct tipc_link *tnl,
9292
struct sk_buff_head *xmitq);
93+
void tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl,
94+
struct sk_buff_head *xmitq);
9395
void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
9496
int tipc_link_fsm_evt(struct tipc_link *l, int evt);
9597
bool tipc_link_is_up(struct tipc_link *l);

‎net/tipc/node.c‎

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,6 @@ static void __tipc_node_link_up(struct tipc_node *n, int bearer_id,
714714
*slot0 = bearer_id;
715715
*slot1 = bearer_id;
716716
tipc_node_fsm_evt(n, SELF_ESTABL_CONTACT_EVT);
717-
n->failover_sent = false;
718717
n->action_flags |= TIPC_NOTIFY_NODE_UP;
719718
tipc_link_set_active(nl, true);
720719
tipc_bcast_add_peer(n->net, nl, xmitq);
@@ -756,6 +755,45 @@ static void tipc_node_link_up(struct tipc_node *n, int bearer_id,
756755
tipc_node_write_unlock(n);
757756
}
758757

758+
/**
759+
* tipc_node_link_failover() - start failover in case "half-failover"
760+
*
761+
* This function is only called in a very special situation where link
762+
* failover can be already started on peer node but not on this node.
763+
* This can happen when e.g.
764+
* 1. Both links <1A-2A>, <1B-2B> down
765+
* 2. Link endpoint 2A up, but 1A still down (e.g. due to network
766+
* disturbance, wrong session, etc.)
767+
* 3. Link <1B-2B> up
768+
* 4. Link endpoint 2A down (e.g. due to link tolerance timeout)
769+
* 5. Node B starts failover onto link <1B-2B>
770+
*
771+
* ==> Node A does never start link/node failover!
772+
*
773+
* @n: tipc node structure
774+
* @l: link peer endpoint failingover (- can be NULL)
775+
* @tnl: tunnel link
776+
* @xmitq: queue for messages to be xmited on tnl link later
777+
*/
778+
static void tipc_node_link_failover(struct tipc_node *n, struct tipc_link *l,
779+
struct tipc_link *tnl,
780+
struct sk_buff_head *xmitq)
781+
{
782+
/* Avoid to be "self-failover" that can never end */
783+
if (!tipc_link_is_up(tnl))
784+
return;
785+
786+
tipc_link_fsm_evt(tnl, LINK_SYNCH_END_EVT);
787+
tipc_node_fsm_evt(n, NODE_SYNCH_END_EVT);
788+
789+
n->sync_point = tipc_link_rcv_nxt(tnl) + (U16_MAX / 2 - 1);
790+
tipc_link_failover_prepare(l, tnl, xmitq);
791+
792+
if (l)
793+
tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT);
794+
tipc_node_fsm_evt(n, NODE_FAILOVER_BEGIN_EVT);
795+
}
796+
759797
/**
760798
* __tipc_node_link_down - handle loss of link
761799
*/
@@ -1675,14 +1713,16 @@ static bool tipc_node_check_state(struct tipc_node *n, struct sk_buff *skb,
16751713
tipc_skb_queue_splice_tail_init(tipc_link_inputq(pl),
16761714
tipc_link_inputq(l));
16771715
}
1716+
16781717
/* If parallel link was already down, and this happened before
1679-
* the tunnel link came up, FAILOVER was never sent. Ensure that
1680-
* FAILOVER is sent to get peer out of NODE_FAILINGOVER state.
1718+
* the tunnel link came up, node failover was never started.
1719+
* Ensure that a FAILOVER_MSG is sent to get peer out of
1720+
* NODE_FAILINGOVER state, also this node must accept
1721+
* TUNNEL_MSGs from peer.
16811722
*/
1682-
if (n->state != NODE_FAILINGOVER && !n->failover_sent) {
1683-
tipc_link_create_dummy_tnl_msg(l, xmitq);
1684-
n->failover_sent = true;
1685-
}
1723+
if (n->state != NODE_FAILINGOVER)
1724+
tipc_node_link_failover(n, pl, l, xmitq);
1725+
16861726
/* If pkts arrive out of order, use lowest calculated syncpt */
16871727
if (less(syncpt, n->sync_point))
16881728
n->sync_point = syncpt;

0 commit comments

Comments
 (0)