]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
bonding: fix state transition issue in link monitoring
authorJay Vosburgh <jay.vosburgh@canonical.com>
Sat, 2 Nov 2019 04:56:42 +0000 (21:56 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Nov 2019 01:40:16 +0000 (17:40 -0800)
commit1899bb325149e481de31a4f32b59ea6f24e176ea
tree50577794ca728a66af5440f914dbafe40095b096
parent41de23e2232bbf8067cb1f6fe71a476046d9be88
bonding: fix state transition issue in link monitoring

Since de77ecd4ef02 ("bonding: improve link-status update in
mii-monitoring"), the bonding driver has utilized two separate variables
to indicate the next link state a particular slave should transition to.
Each is used to communicate to a different portion of the link state
change commit logic; one to the bond_miimon_commit function itself, and
another to the state transition logic.

Unfortunately, the two variables can become unsynchronized,
resulting in incorrect link state transitions within bonding.  This can
cause slaves to become stuck in an incorrect link state until a
subsequent carrier state transition.

The issue occurs when a special case in bond_slave_netdev_event
sets slave->link directly to BOND_LINK_FAIL.  On the next pass through
bond_miimon_inspect after the slave goes carrier up, the BOND_LINK_FAIL
case will set the proposed next state (link_new_state) to BOND_LINK_UP,
but the new_link to BOND_LINK_DOWN.  The setting of the final link state
from new_link comes after that from link_new_state, and so the slave
will end up incorrectly in _DOWN state.

Resolve this by combining the two variables into one.

Reported-by: Aleksei Zakharov <zakharov.a.g@yandex.ru>
Reported-by: Sha Zhang <zhangsha.zhang@huawei.com>
Cc: Mahesh Bandewar <maheshb@google.com>
Fixes: de77ecd4ef02 ("bonding: improve link-status update in mii-monitoring")
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c
include/net/bonding.h