teamd: use enabled option_changed to sync enabled to link_up for lb runner
LiLiang found an issue that after adding two ports into a team device with
lb mode their enabled option sometimes is false.
It was caused by the unexpected events order:
0. team_port_add() in kernel.
1. port_change event A1 sent to userspace.
2. option_change event B1 sent to userspace.
3. port_change event A2 sent to userspace IF port is up now.
4. process port_change event A1 and set port's enabled option 'false'.
5. option_change event B2 sent to userspace.
6. process option_change event B1 and sync enabled option (value = 1).
7. process port_change event A2 and do nothing as enabled option is 1.
8. process option_change event B2 and sync enabled option (value = 0).
In kernel, when the port is still down after dev_open(), which happens more
often since it changed to use netif_oper_up() to check the state instead of
netif_carrier_ok(), the event A2 in Step 3 can be sent at any moment. When
it's ahead of Step 4, Step 7 won't set enabled option to 1 as Step 8 comes
As the port up event can be triggered by dev_watchdog at anytime in kernel,
the port_change and option_change events order can not be controlled. What
can only be done here is to correct it at Step 8, to sync enabled option to
So this patch is to add enabled option_changed for lb mode to do this sync.
Reported-by: LiLiang <firstname.lastname@example.org>
Signed-off-by: Xin Long <email@example.com>
Signed-off-by: Jiri Pirko <firstname.lastname@example.org>
1 file changed