diff mbox series

teamd: add port_master_ifindex_changed for link_watch_port_watch_ops

Message ID 2d632cd7b9a5246c78c84e0b077dde998fc31d73.1561966794.git.lucien.xin@gmail.com (mailing list archive)
State New
Headers show
Series teamd: add port_master_ifindex_changed for link_watch_port_watch_ops | expand

Commit Message

Xin Long July 1, 2019, 7:39 a.m. UTC
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@redhat.com>
Fixes: b6f63db7f3c8 ("teamd: add port_master_ifindex_changed for teamd_event_watch_ops")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 teamd/teamd_link_watch.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Jiri Pirko July 2, 2019, 10:10 a.m. UTC | #1
Mon, Jul 01, 2019 at 09:39:54AM CEST, lucien.xin@gmail.com wrote:
>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@redhat.com>
>Fixes: b6f63db7f3c8 ("teamd: add port_master_ifindex_changed for teamd_event_watch_ops")
>Signed-off-by: Xin Long <lucien.xin@gmail.com>

applied, thanks!
diff mbox series

Patch

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",
 };