aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2018-01-08 15:03:27 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-09 12:35:57 -0500
commitc2b22bcf2e18a279afd80a8c57e936014acf3348 (patch)
tree0e1a7863d37b590d7cb86e5fb187a7d80d7bbaa7 /net/tipc
parent7ad32bcb7855ae8a60a8cf98e1b9da77cfdba4d0 (diff)
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')
-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,
749 list_del_init(&m->list); 749 list_del_init(&m->list);
750 list_del_init(&m->small_win); 750 list_del_init(&m->small_win);
751 *usr_wakeup = true; 751 *usr_wakeup = true;
752 752 tipc_group_decr_active(grp, m);
753 /* Wait until WITHDRAW event is received */ 753 m->state = MBR_LEAVING;
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 */
760 tipc_group_create_event(grp, m, TIPC_WITHDRAWN, 754 tipc_group_create_event(grp, m, TIPC_WITHDRAWN,
761 m->bc_syncpt, inputq); 755 m->bc_syncpt, inputq);
762 return; 756 return;
@@ -838,7 +832,6 @@ void tipc_group_member_evt(struct tipc_group *grp,
838 int event = evt->event; 832 int event = evt->event;
839 struct tipc_member *m; 833 struct tipc_member *m;
840 struct net *net; 834 struct net *net;
841 bool node_up;
842 u32 self; 835 u32 self;
843 836
844 if (!grp) 837 if (!grp)
@@ -878,30 +871,15 @@ void tipc_group_member_evt(struct tipc_group *grp,
878 871
879 *usr_wakeup = true; 872 *usr_wakeup = true;
880 m->usr_pending = false; 873 m->usr_pending = false;
881 node_up = tipc_node_is_up(net, node); 874 tipc_group_decr_active(grp, m);
882 875 m->state = MBR_LEAVING;
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 }
903 list_del_init(&m->list); 876 list_del_init(&m->list);
904 list_del_init(&m->small_win); 877 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);
905 } 883 }
906 *sk_rcvbuf = tipc_group_rcvbuf_limit(grp); 884 *sk_rcvbuf = tipc_group_rcvbuf_limit(grp);
907} 885}