summaryrefslogtreecommitdiffstats
path: root/net/tipc/group.c
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2018-01-08 21:03:27 +0100
committerDavid S. Miller <davem@davemloft.net>2018-01-09 18:35:57 +0100
commitc2b22bcf2e18a279afd80a8c57e936014acf3348 (patch)
tree0e1a7863d37b590d7cb86e5fb187a7d80d7bbaa7 /net/tipc/group.c
parenttipc: create group member event messages when they are needed (diff)
downloadlinux-c2b22bcf2e18a279afd80a8c57e936014acf3348.tar.xz
linux-c2b22bcf2e18a279afd80a8c57e936014acf3348.zip
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 <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/group.c')
-rw-r--r--net/tipc/group.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/net/tipc/group.c b/net/tipc/group.c
index e08b7acc7b2d..bdc54be9c07e 100644
--- a/net/tipc/group.c
+++ b/net/tipc/group.c
@@ -749,14 +749,8 @@ void tipc_group_proto_rcv(struct tipc_group *grp, bool *usr_wakeup,
list_del_init(&m->list);
list_del_init(&m->small_win);
*usr_wakeup = true;
-
- /* Wait until WITHDRAW event is received */
- if (m->state != MBR_LEAVING) {
- tipc_group_decr_active(grp, m);
- m->state = MBR_LEAVING;
- return;
- }
- /* Otherwise deliver member WITHDRAW event */
+ tipc_group_decr_active(grp, m);
+ m->state = MBR_LEAVING;
tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
m->bc_syncpt, inputq);
return;
@@ -838,7 +832,6 @@ void tipc_group_member_evt(struct tipc_group *grp,
int event = evt->event;
struct tipc_member *m;
struct net *net;
- bool node_up;
u32 self;
if (!grp)
@@ -878,30 +871,15 @@ void tipc_group_member_evt(struct tipc_group *grp,
*usr_wakeup = true;
m->usr_pending = false;
- node_up = tipc_node_is_up(net, node);
-
- if (node_up) {
- /* Hold back event if a LEAVE msg should be expected */
- if (m->state != MBR_LEAVING) {
- tipc_group_decr_active(grp, m);
- m->state = MBR_LEAVING;
- } else {
- tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
- m->bc_syncpt, inputq);
- }
- } else {
- if (m->state != MBR_LEAVING) {
- tipc_group_decr_active(grp, m);
- m->state = MBR_LEAVING;
- tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
- m->bc_rcv_nxt, inputq);
- } else {
- tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
- m->bc_syncpt, inputq);
- }
- }
+ tipc_group_decr_active(grp, m);
+ m->state = MBR_LEAVING;
list_del_init(&m->list);
list_del_init(&m->small_win);
+
+ /* Only send event if no LEAVE message can be expected */
+ if (!tipc_node_is_up(net, node))
+ tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
+ m->bc_rcv_nxt, inputq);
}
*sk_rcvbuf = tipc_group_rcvbuf_limit(grp);
}