Skip to content

Commit c244c09

Browse files
Tung Nguyendavem330
Tung Nguyen
authored andcommitted
tipc: fix unexpected link reset due to discovery messages
This unexpected behavior is observed: node 1 | node 2 ------ | ------ link is established | link is established reboot | link is reset up | send discovery message receive discovery message | link is established | link is established send discovery message | | receive discovery message | link is reset (unexpected) | send reset message link is reset | It is due to delayed re-discovery as described in function tipc_node_check_dest(): "this link endpoint has already reset and re-established contact with the peer, before receiving a discovery message from that node." However, commit 598411d has changed the condition for calling tipc_node_link_down() which was the acceptance of new media address. This commit fixes this by restoring the old and correct behavior. Fixes: 598411d ("tipc: make resetting of links non-atomic") Acked-by: Jon Maloy <[email protected]> Signed-off-by: Tung Nguyen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent eea8ce8 commit c244c09

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

net/tipc/node.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,8 +1179,9 @@ void tipc_node_check_dest(struct net *net, u32 addr,
11791179
bool addr_match = false;
11801180
bool sign_match = false;
11811181
bool link_up = false;
1182+
bool link_is_reset = false;
11821183
bool accept_addr = false;
1183-
bool reset = true;
1184+
bool reset = false;
11841185
char *if_name;
11851186
unsigned long intv;
11861187
u16 session;
@@ -1200,14 +1201,14 @@ void tipc_node_check_dest(struct net *net, u32 addr,
12001201
/* Prepare to validate requesting node's signature and media address */
12011202
l = le->link;
12021203
link_up = l && tipc_link_is_up(l);
1204+
link_is_reset = l && tipc_link_is_reset(l);
12031205
addr_match = l && !memcmp(&le->maddr, maddr, sizeof(*maddr));
12041206
sign_match = (signature == n->signature);
12051207

12061208
/* These three flags give us eight permutations: */
12071209

12081210
if (sign_match && addr_match && link_up) {
1209-
/* All is fine. Do nothing. */
1210-
reset = false;
1211+
/* All is fine. Ignore requests. */
12111212
/* Peer node is not a container/local namespace */
12121213
if (!n->peer_hash_mix)
12131214
n->peer_hash_mix = hash_mixes;
@@ -1232,6 +1233,7 @@ void tipc_node_check_dest(struct net *net, u32 addr,
12321233
*/
12331234
accept_addr = true;
12341235
*respond = true;
1236+
reset = true;
12351237
} else if (!sign_match && addr_match && link_up) {
12361238
/* Peer node rebooted. Two possibilities:
12371239
* - Delayed re-discovery; this link endpoint has already
@@ -1263,6 +1265,7 @@ void tipc_node_check_dest(struct net *net, u32 addr,
12631265
n->signature = signature;
12641266
accept_addr = true;
12651267
*respond = true;
1268+
reset = true;
12661269
}
12671270

12681271
if (!accept_addr)
@@ -1291,6 +1294,7 @@ void tipc_node_check_dest(struct net *net, u32 addr,
12911294
tipc_link_fsm_evt(l, LINK_RESET_EVT);
12921295
if (n->state == NODE_FAILINGOVER)
12931296
tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT);
1297+
link_is_reset = tipc_link_is_reset(l);
12941298
le->link = l;
12951299
n->link_cnt++;
12961300
tipc_node_calculate_timer(n, l);
@@ -1303,7 +1307,7 @@ void tipc_node_check_dest(struct net *net, u32 addr,
13031307
memcpy(&le->maddr, maddr, sizeof(*maddr));
13041308
exit:
13051309
tipc_node_write_unlock(n);
1306-
if (reset && l && !tipc_link_is_reset(l))
1310+
if (reset && !link_is_reset)
13071311
tipc_node_link_down(n, b->identity, false);
13081312
tipc_node_put(n);
13091313
}

0 commit comments

Comments
 (0)