linux-stable/drivers/net/bonding
Nikolay Aleksandrov b8e4500f42 bonding: fix curr_active_slave/carrier with loadbalance arp monitoring
Since commit 6fde8f037e ("bonding: fix locking in
bond_loadbalance_arp_mon()") we can have a stale bond carrier state and
stale curr_active_slave when using arp monitoring in loadbalance modes. The
reason is that in bond_loadbalance_arp_mon() we can't have
do_failover == true but slave_state_changed == false, whenever do_failover
is true then slave_state_changed is also true. Then the following piece
from bond_loadbalance_arp_mon():
                if (slave_state_changed) {
                        bond_slave_state_change(bond);
                        if (BOND_MODE(bond) == BOND_MODE_XOR)
                                bond_update_slave_arr(bond, NULL);
                } else if (do_failover) {
                        block_netpoll_tx();
                        bond_select_active_slave(bond);
                        unblock_netpoll_tx();
                }

will execute only the first branch, always and regardless of do_failover.
Since these two events aren't related in such way, we need to decouple and
consider them separately.

For example this issue could lead to the following result:
Bonding Mode: load balancing (round-robin)
*MII Status: down*
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
ARP Polling Interval (ms): 100
ARP IP target/s (n.n.n.n form): 192.168.9.2

Slave Interface: ens12
*MII Status: up*
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: 00:0f:53:01:42:2c
Slave queue ID: 0

Slave Interface: eth1
*MII Status: up*
Speed: Unknown
Duplex: Unknown
Link Failure Count: 70
Permanent HW addr: 52:54:00:2f:0f:8e
Slave queue ID: 0

Since some interfaces are up, then the status of the bond should also be
up, but it will never change unless something invokes bond_set_carrier()
(i.e. enslave, bond_select_active_slave etc). Now, if I force the
calling of bond_select_active_slave via for example changing
primary_reselect (it can change in any mode), then the MII status goes to
"up" because it calls bond_select_active_slave() which should've been done
from bond_loadbalance_arp_mon() itself.

CC: Veaceslav Falico <vfalico@gmail.com>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: Ding Tianhong <dingtianhong@huawei.com>

Fixes: 6fde8f037e ("bonding: fix locking in bond_loadbalance_arp_mon()")
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Acked-by: Veaceslav Falico <vfalico@gmail.com>
Acked-by: Andy Gospodarek <gospo@cumulusnetworks.com>
Acked-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-11-19 15:09:04 -05:00
..
bond_3ad.c bonding: Simplify the xmit function for modes that use xmit_hash 2014-10-06 17:13:07 -04:00
bond_3ad.h bonding: 3ad: convert to bond->mode_lock 2014-09-13 16:29:07 -04:00
bond_alb.c bonding: Simplify the xmit function for modes that use xmit_hash 2014-10-06 17:13:07 -04:00
bond_alb.h bonding: Simplify the xmit function for modes that use xmit_hash 2014-10-06 17:13:07 -04:00
bond_debugfs.c bonding: trivial: style and comment fixes 2014-09-15 17:19:49 -04:00
bond_main.c bonding: fix curr_active_slave/carrier with loadbalance arp monitoring 2014-11-19 15:09:04 -05:00
bond_netlink.c bonding: convert primary_slave to use RCU 2014-09-09 17:31:35 -07:00
bond_options.c bonding: clean curr_slave_lock use 2014-09-13 16:29:06 -04:00
bond_options.h bonding: make a generic sysfs option store and fix comments 2014-05-09 16:12:51 -04:00
bond_procfs.c bonding: display xmit_hash_policy for non-dynamic-tlb mode 2014-10-06 17:13:07 -04:00
bond_sysfs.c bonding: trivial: style and comment fixes 2014-09-15 17:19:49 -04:00
bond_sysfs_slave.c treewide: Fix typo in printk 2014-08-26 09:35:54 +02:00
bonding.h bonding: Simplify the xmit function for modes that use xmit_hash 2014-10-06 17:13:07 -04:00
Makefile bonding: add sysfs /slave dir for bond slave devices. 2014-01-17 18:51:58 -08:00