Skip to content

Commit

Permalink
[teamd] do not process lacpdu before the port ifinfo is set
Browse files Browse the repository at this point in the history
Port libteam patch which fixes the race condition we observed during
warm reboot.

Remove early patches: 0006, 0008, 0009.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
  • Loading branch information
yxieca committed Apr 29, 2019
1 parent b186bb2 commit 5f03e41
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 173 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 28ccb37eb388e7e3d214a9b05011f8421f0d65ac Mon Sep 17 00:00:00 2001
From: Ying Xie <ying.xie@microsoft.com>
Date: Fri, 26 Apr 2019 23:30:38 +0000
Subject: [PATCH] teamd: do not process lacpdu before the port ifinfo is set

Now the port ifinfo will be set in obj_input_newlink when a RTM_NEWLINK
event is received.

But when a port is being added, if a lacpdu gets received on this port
before the RTM_NEWLINK event, lacpdu_recv will process the packet with
incorrect port ifinfo.

In Patrick's case, as ifinfo->master_ifindex was 0, it would skip this
port in teamd_for_each_tdport, which caused lacp_port->agg_lead not to
be updated in lacp_switch_agg_lead. Later the lacp_port actor would go
to a unexpected state.

This patch is to avoid it by checking teamd_port_present in lacpdu_recv
so that it would not process lacpdu before the port ifinfo is set.

Reported-by: Patrick Talbert <ptalbert@redhat.com>
Tested-by: Patrick Talbert <ptalbert@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
teamd/teamd_runner_lacp.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 78f05dd..c8ae541 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -1132,6 +1132,9 @@ static int lacpdu_process(struct lacp_port *lacp_port, struct lacpdu* lacpdu)
{
int err;

+ if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport))
+ return 0;
+
if (!lacpdu_check(lacpdu)) {
teamd_log_warn("malformed LACP PDU came.");
return 0;
--
2.7.4

6 changes: 2 additions & 4 deletions src/libteam/series
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch
0004-libteam-Add-lacp-fallback-support-for-single-member-.patch
0005-libteam-Add-warm_reboot-mode.patch
0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch
0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch
0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch
0009-teamd-prevent-private-change-handler-reentrance.patch
0010-teamd-lacp-update-port-state-according-to-partners-sy.patch
0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch
0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch
0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch

0 comments on commit 5f03e41

Please sign in to comment.