Skip to content

Commit c2b22bc

Browse files
Jon Maloydavem330
authored andcommitted
tipc: simplify group LEAVE sequence
After the changes in the previous commit the group LEAVE sequence can be simplified. We now let the arrival of a LEAVE message unconditionally issue a group DOWN event to the user. When a topology WITHDRAW event is received, the member, if it still there, is set to state LEAVING, but we only issue a group DOWN event when the link to the peer node is gone, so that no LEAVE message is to be expected. Acked-by: Ying Xue <[email protected]> Signed-off-by: Jon Maloy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7ad32bc commit c2b22bc

File tree

1 file changed

+9
-31
lines changed

1 file changed

+9
-31
lines changed

net/tipc/group.c

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -749,14 +749,8 @@ void tipc_group_proto_rcv(struct tipc_group *grp, bool *usr_wakeup,
749749
list_del_init(&m->list);
750750
list_del_init(&m->small_win);
751751
*usr_wakeup = true;
752-
753-
/* Wait until WITHDRAW event is received */
754-
if (m->state != MBR_LEAVING) {
755-
tipc_group_decr_active(grp, m);
756-
m->state = MBR_LEAVING;
757-
return;
758-
}
759-
/* Otherwise deliver member WITHDRAW event */
752+
tipc_group_decr_active(grp, m);
753+
m->state = MBR_LEAVING;
760754
tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
761755
m->bc_syncpt, inputq);
762756
return;
@@ -838,7 +832,6 @@ void tipc_group_member_evt(struct tipc_group *grp,
838832
int event = evt->event;
839833
struct tipc_member *m;
840834
struct net *net;
841-
bool node_up;
842835
u32 self;
843836

844837
if (!grp)
@@ -878,30 +871,15 @@ void tipc_group_member_evt(struct tipc_group *grp,
878871

879872
*usr_wakeup = true;
880873
m->usr_pending = false;
881-
node_up = tipc_node_is_up(net, node);
882-
883-
if (node_up) {
884-
/* Hold back event if a LEAVE msg should be expected */
885-
if (m->state != MBR_LEAVING) {
886-
tipc_group_decr_active(grp, m);
887-
m->state = MBR_LEAVING;
888-
} else {
889-
tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
890-
m->bc_syncpt, inputq);
891-
}
892-
} else {
893-
if (m->state != MBR_LEAVING) {
894-
tipc_group_decr_active(grp, m);
895-
m->state = MBR_LEAVING;
896-
tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
897-
m->bc_rcv_nxt, inputq);
898-
} else {
899-
tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
900-
m->bc_syncpt, inputq);
901-
}
902-
}
874+
tipc_group_decr_active(grp, m);
875+
m->state = MBR_LEAVING;
903876
list_del_init(&m->list);
904877
list_del_init(&m->small_win);
878+
879+
/* Only send event if no LEAVE message can be expected */
880+
if (!tipc_node_is_up(net, node))
881+
tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
882+
m->bc_rcv_nxt, inputq);
905883
}
906884
*sk_rcvbuf = tipc_group_rcvbuf_limit(grp);
907885
}

0 commit comments

Comments
 (0)