]> git.baikalelectronics.ru Git - kernel.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)
commit83d4936fc468972b4eb26b686ca3ea1a45b782b6
tree50577794ca728a66af5440f914dbafe40095b096
parent604a8e0720b7e9a6b3683dd24045032ee13c166d
bonding: fix state transition issue in link monitoring

Since 7bd12da0d40b ("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: 7bd12da0d40b ("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