From 5f351666409ffe05f40012e5bf135807d4d0260c Mon Sep 17 00:00:00 2001 From: Xin Long Date: Mon, 1 Jul 2019 15:39:54 +0800 Subject: [PATCH] teamd: add port_master_ifindex_changed for link_watch_port_watch_ops 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 Fixes: b6f63db7f3c8 ("teamd: add port_master_ifindex_changed for teamd_event_watch_ops") Signed-off-by: Xin Long Signed-off-by: Jiri Pirko --- 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", };