linux/drivers/net/bonding
Jay Vosburgh 1899bb3251 bonding: fix state transition issue in link monitoring
Since de77ecd4ef ("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: de77ecd4ef ("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>
2019-11-05 17:40:16 -08:00
..
bond_3ad.c bonding/802.3ad: convert to using slave printk macros 2019-06-09 13:36:01 -07:00
bond_alb.c net: remove unnecessary variables and callback 2019-10-24 14:53:49 -07:00
bond_debugfs.c bonding: no need to print a message if debugfs_create_dir() fails 2019-08-10 15:25:47 -07:00
bond_main.c bonding: fix state transition issue in link monitoring 2019-11-05 17:40:16 -08:00
bond_netlink.c bonding: fix value exported by Netlink for peer_notif_delay 2019-07-08 19:28:44 -07:00
bond_options.c bonding: add an option to specify a delay between peer notifications 2019-07-04 12:30:48 -07:00
bond_procfs.c bonding: add an option to specify a delay between peer notifications 2019-07-04 12:30:48 -07:00
bond_sysfs_slave.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
bond_sysfs.c bonding: add an option to specify a delay between peer notifications 2019-07-04 12:30:48 -07:00
bonding_priv.h net/bonding: Make DRV macros private 2015-04-26 22:59:53 -04:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00