Skip to content

Commit 95f387c

Browse files
authored
Fix issue: wrong teamd link watch state after warm reboot (#14084) (#14575)
1 parent fff0e7d commit 95f387c

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch

+55-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ Subject: [PATCH] [libteam]: Reimplement Warm-Reboot procedure'
55

66
---
77
libteam/ifinfo.c | 6 +-
8+
libteam/ports.c | 19 +-
89
teamd/teamd.c | 51 +++-
910
teamd/teamd.h | 6 +
1011
teamd/teamd_events.c | 13 ++
1112
teamd/teamd_per_port.c | 6 +
1213
teamd/teamd_runner_lacp.c | 475 +++++++++++++++++++++++++++++++++++---
13-
6 files changed, 513 insertions(+), 44 deletions(-)
14+
7 files changed, 530 insertions(+), 46 deletions(-)
1415

1516
diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
1617
index 46d56a2..b86d34c 100644
@@ -34,6 +35,58 @@ index 46d56a2..b86d34c 100644
3435
set_changed(ifinfo, CHANGED_HWADDR);
3536
}
3637
}
38+
diff --git a/libteam/ports.c b/libteam/ports.c
39+
index 9ebf30f..0bd7cc0 100644
40+
--- a/libteam/ports.c
41+
+++ b/libteam/ports.c
42+
@@ -128,6 +128,12 @@ int get_port_list_handler(struct nl_msg *msg, void *arg)
43+
struct nlattr *port_attrs[TEAM_ATTR_PORT_MAX + 1];
44+
int i;
45+
uint32_t team_ifindex = 0;
46+
+ /*
47+
+ * In case get_port_list is being called from check_call_change_handlers recursively,
48+
+ * there can be some attributes which have not been consumed by callbacks.
49+
+ * In this case, we should only merge the new attributes into the existing ones without clearing them
50+
+ */
51+
+ bool recursive = (th->change_handler.pending_type_mask & TEAM_PORT_CHANGE) ? true : false;
52+
53+
genlmsg_parse(nlh, 0, attrs, TEAM_ATTR_MAX, NULL);
54+
if (attrs[TEAM_ATTR_TEAM_IFINDEX])
55+
@@ -140,7 +146,8 @@ int get_port_list_handler(struct nl_msg *msg, void *arg)
56+
return NL_SKIP;
57+
58+
if (!th->msg_recv_started) {
59+
- port_list_cleanup_last_state(th);
60+
+ if (!recursive)
61+
+ port_list_cleanup_last_state(th);
62+
th->msg_recv_started = true;
63+
}
64+
nla_for_each_nested(nl_port, attrs[TEAM_ATTR_LIST_PORT], i) {
65+
@@ -165,7 +172,9 @@ int get_port_list_handler(struct nl_msg *msg, void *arg)
66+
if (!port)
67+
return NL_SKIP;
68+
}
69+
- port->changed = port_attrs[TEAM_ATTR_PORT_CHANGED] ? true : false;
70+
+
71+
+ if (!port->changed || !recursive)
72+
+ port->changed = port_attrs[TEAM_ATTR_PORT_CHANGED] ? true : false;
73+
port->linkup = port_attrs[TEAM_ATTR_PORT_LINKUP] ? true : false;
74+
port->removed = port_attrs[TEAM_ATTR_PORT_REMOVED] ? true : false;
75+
if (port_attrs[TEAM_ATTR_PORT_SPEED])
76+
@@ -196,6 +204,13 @@ static int get_port_list(struct team_handle *th)
77+
if (err)
78+
return err;
79+
80+
+ /*
81+
+ * Do not call check_call_change_handlers if this is called recursively to avoid racing conditions
82+
+ * It will be called by the outer call
83+
+ */
84+
+ if (th->change_handler.pending_type_mask & TEAM_PORT_CHANGE)
85+
+ return 0;
86+
+
87+
return check_call_change_handlers(th, TEAM_PORT_CHANGE);
88+
89+
nla_put_failure:
3790
diff --git a/teamd/teamd.c b/teamd/teamd.c
3891
index 421e34d..33512a6 100644
3992
--- a/teamd/teamd.c
@@ -881,5 +934,5 @@ index 955ef0c..782fc05 100644
881934

882935
const struct teamd_runner teamd_runner_lacp = {
883936
--
884-
2.17.1
937+
2.30.2
885938

0 commit comments

Comments
 (0)