This is a follow up of Commit b6f63db7f3c8 ("teamd: add
port_master_ifindex_changed for teamd_event_watch_ops")
to fix the same issue in it.
The issue is a race between option change event and ifinfo
(master_ifindex) change event, so wherever a option change
function tries to iterate tdport by teamd_for_each_tdport,
the same thing should be done in its master_ifindex change
function, including link_watch_port_watch_ops.
The fix has been verified in one customer's env where it
appeared no arp requests coming out on the only state-up
tdport prior to this patch.
Reported-by: Michal Tesar <mtesar(a)redhat.com>
Fixes: b6f63db7f3c8 ("teamd: add port_master_ifindex_changed for
teamd_event_watch_ops")
Signed-off-by: Xin Long <lucien.xin(a)gmail.com>
---
teamd/teamd_link_watch.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/teamd/teamd_link_watch.c b/teamd/teamd_link_watch.c
index 019ec5d..62f8267 100644
--- a/teamd/teamd_link_watch.c
+++ b/teamd/teamd_link_watch.c
@@ -450,10 +450,19 @@ static int link_watch_enabled_option_changed(struct teamd_context
*ctx,
return link_watch_refresh_forced_send(ctx);
}
+
+static int link_watch_port_master_ifindex_changed(struct teamd_context *ctx,
+ struct teamd_port *tdport,
+ void *priv)
+{
+ return link_watch_refresh_forced_send(ctx);
+}
+
static const struct teamd_event_watch_ops link_watch_port_watch_ops = {
.port_added = link_watch_event_watch_port_added,
.port_removed = link_watch_event_watch_port_removed,
.port_link_changed = link_watch_event_watch_port_link_changed,
+ .port_master_ifindex_changed = link_watch_port_master_ifindex_changed,
.option_changed = link_watch_enabled_option_changed,
.option_changed_match_name = "enabled",
};
--
2.1.0