]>
Commit | Line | Data |
---|---|---|
e201c2e6 GKH |
1 | From foo@baz Fri 31 May 2019 03:21:27 PM PDT |
2 | From: Jarod Wilson <jarod@redhat.com> | |
3 | Date: Fri, 24 May 2019 09:49:28 -0400 | |
4 | Subject: bonding/802.3ad: fix slave link initialization transition states | |
5 | ||
6 | From: Jarod Wilson <jarod@redhat.com> | |
7 | ||
8 | [ Upstream commit 334031219a84b9994594015aab85ed7754c80176 ] | |
9 | ||
10 | Once in a while, with just the right timing, 802.3ad slaves will fail to | |
11 | properly initialize, winding up in a weird state, with a partner system | |
12 | mac address of 00:00:00:00:00:00. This started happening after a fix to | |
13 | properly track link_failure_count tracking, where an 802.3ad slave that | |
14 | reported itself as link up in the miimon code, but wasn't able to get a | |
15 | valid speed/duplex, started getting set to BOND_LINK_FAIL instead of | |
16 | BOND_LINK_DOWN. That was the proper thing to do for the general "my link | |
17 | went down" case, but has created a link initialization race that can put | |
18 | the interface in this odd state. | |
19 | ||
20 | The simple fix is to instead set the slave link to BOND_LINK_DOWN again, | |
21 | if the link has never been up (last_link_up == 0), so the link state | |
22 | doesn't bounce from BOND_LINK_DOWN to BOND_LINK_FAIL -- it hasn't failed | |
23 | in this case, it simply hasn't been up yet, and this prevents the | |
24 | unnecessary state change from DOWN to FAIL and getting stuck in an init | |
25 | failure w/o a partner mac. | |
26 | ||
27 | Fixes: ea53abfab960 ("bonding/802.3ad: fix link_failure_count tracking") | |
28 | CC: Jay Vosburgh <j.vosburgh@gmail.com> | |
29 | CC: Veaceslav Falico <vfalico@gmail.com> | |
30 | CC: Andy Gospodarek <andy@greyhouse.net> | |
31 | CC: "David S. Miller" <davem@davemloft.net> | |
32 | CC: netdev@vger.kernel.org | |
33 | Tested-by: Heesoon Kim <Heesoon.Kim@stratus.com> | |
34 | Signed-off-by: Jarod Wilson <jarod@redhat.com> | |
35 | Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com> | |
36 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
37 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
38 | --- | |
39 | drivers/net/bonding/bond_main.c | 15 ++++++++++----- | |
40 | 1 file changed, 10 insertions(+), 5 deletions(-) | |
41 | ||
42 | --- a/drivers/net/bonding/bond_main.c | |
43 | +++ b/drivers/net/bonding/bond_main.c | |
44 | @@ -3107,13 +3107,18 @@ static int bond_slave_netdev_event(unsig | |
45 | case NETDEV_CHANGE: | |
46 | /* For 802.3ad mode only: | |
47 | * Getting invalid Speed/Duplex values here will put slave | |
48 | - * in weird state. So mark it as link-fail for the time | |
49 | - * being and let link-monitoring (miimon) set it right when | |
50 | - * correct speeds/duplex are available. | |
51 | + * in weird state. Mark it as link-fail if the link was | |
52 | + * previously up or link-down if it hasn't yet come up, and | |
53 | + * let link-monitoring (miimon) set it right when correct | |
54 | + * speeds/duplex are available. | |
55 | */ | |
56 | if (bond_update_speed_duplex(slave) && | |
57 | - BOND_MODE(bond) == BOND_MODE_8023AD) | |
58 | - slave->link = BOND_LINK_FAIL; | |
59 | + BOND_MODE(bond) == BOND_MODE_8023AD) { | |
60 | + if (slave->last_link_up) | |
61 | + slave->link = BOND_LINK_FAIL; | |
62 | + else | |
63 | + slave->link = BOND_LINK_DOWN; | |
64 | + } | |
65 | ||
66 | if (BOND_MODE(bond) == BOND_MODE_8023AD) | |
67 | bond_3ad_adapter_speed_duplex_changed(slave); |