]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.19/bonding-802.3ad-fix-slave-link-initialization-transition-states.patch
4.19-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / bonding-802.3ad-fix-slave-link-initialization-transition-states.patch
CommitLineData
e201c2e6
GKH
1From foo@baz Fri 31 May 2019 03:21:27 PM PDT
2From: Jarod Wilson <jarod@redhat.com>
3Date: Fri, 24 May 2019 09:49:28 -0400
4Subject: bonding/802.3ad: fix slave link initialization transition states
5
6From: Jarod Wilson <jarod@redhat.com>
7
8[ Upstream commit 334031219a84b9994594015aab85ed7754c80176 ]
9
10Once in a while, with just the right timing, 802.3ad slaves will fail to
11properly initialize, winding up in a weird state, with a partner system
12mac address of 00:00:00:00:00:00. This started happening after a fix to
13properly track link_failure_count tracking, where an 802.3ad slave that
14reported itself as link up in the miimon code, but wasn't able to get a
15valid speed/duplex, started getting set to BOND_LINK_FAIL instead of
16BOND_LINK_DOWN. That was the proper thing to do for the general "my link
17went down" case, but has created a link initialization race that can put
18the interface in this odd state.
19
20The simple fix is to instead set the slave link to BOND_LINK_DOWN again,
21if the link has never been up (last_link_up == 0), so the link state
22doesn't bounce from BOND_LINK_DOWN to BOND_LINK_FAIL -- it hasn't failed
23in this case, it simply hasn't been up yet, and this prevents the
24unnecessary state change from DOWN to FAIL and getting stuck in an init
25failure w/o a partner mac.
26
27Fixes: ea53abfab960 ("bonding/802.3ad: fix link_failure_count tracking")
28CC: Jay Vosburgh <j.vosburgh@gmail.com>
29CC: Veaceslav Falico <vfalico@gmail.com>
30CC: Andy Gospodarek <andy@greyhouse.net>
31CC: "David S. Miller" <davem@davemloft.net>
32CC: netdev@vger.kernel.org
33Tested-by: Heesoon Kim <Heesoon.Kim@stratus.com>
34Signed-off-by: Jarod Wilson <jarod@redhat.com>
35Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
36Signed-off-by: David S. Miller <davem@davemloft.net>
37Signed-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);