remarkable-linux/drivers/net
Nithin Sujir 797a93647a bonding: Don't update slave->link until ready to commit
In the loadbalance arp monitoring scheme, when a slave link change is
detected, the slave->link is immediately updated and slave_state_changed
is set. Later down the function, the rtnl_lock is acquired and the
changes are committed, updating the bond link state.

However, the acquisition of the rtnl_lock can fail. The next time the
monitor runs, since slave->link is already updated, it determines that
link is unchanged. This results in the bond link state permanently out
of sync with the slave link.

This patch modifies bond_loadbalance_arp_mon() to handle link changes
identical to bond_ab_arp_{inspect/commit}(). The new link state is
maintained in slave->new_link until we're ready to commit at which point
it's copied into slave->link.

NOTE: miimon_{inspect/commit}() has a more complex state machine
requiring the use of the bond_{propose,commit}_link_state() functions
which maintains the intermediate state in slave->link_new_state. The arp
monitors don't require that.

Testing: This bug is very easy to reproduce with the following steps.
1. In a loop, toggle a slave link of a bond slave interface.
2. In a separate loop, do ifconfig up/down of an unrelated interface to
create contention for rtnl_lock.
Within a few iterations, the bond link goes out of sync with the slave
link.

Signed-off-by: Nithin Nayak Sujir <nsujir@tintri.com>
Cc: Mahesh Bandewar <maheshb@google.com>
Cc: Jay Vosburgh <jay.vosburgh@canonical.com>
Acked-by: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-05-25 14:47:35 -04:00
..
appletalk
arcnet
bonding bonding: Don't update slave->link until ready to commit 2017-05-25 14:47:35 -04:00
caif
can Annotation of module parameters that specify device settings 2017-05-10 19:13:03 -07:00
cris
dsa net: dsa: mv88e6xxx: add default case to switch 2017-05-12 12:14:40 -04:00
ethernet be2net: Fix offload features for Q-in-Q packets 2017-05-24 16:27:14 -04:00
fddi format-security: move static strings to const 2017-05-08 17:15:14 -07:00
fjes
hamradio Annotation of module parameters that specify device settings 2017-05-10 19:13:03 -07:00
hippi Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-05-09 15:42:31 -07:00
hyperv netvsc: make sure napi enabled before vmbus_open 2017-05-04 11:08:36 -04:00
ieee802154
ipvlan
irda Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-05-15 15:50:49 -07:00
phy net: phy: marvell: Limit errata to 88m1101 2017-05-24 15:49:08 -04:00
plip
ppp
slip
team
usb cdc-ether: divorce initialisation with a filter reset and a generic method 2017-05-23 11:01:28 -04:00
vmxnet3 vmxnet3: ensure that adapter is in proper state during force_close 2017-05-12 12:23:52 -04:00
wan Annotation of module parameters that specify device settings 2017-05-10 19:13:03 -07:00
wimax drivers: net: wimax: i2400m: i2400m-usb: Use time_after for time comparison 2017-05-09 09:40:33 -04:00
wireless Annotation of module parameters that specify device settings 2017-05-10 19:13:03 -07:00
xen-netback
dummy.c
eql.c
geneve.c geneve: fix fill_info when using collect_metadata 2017-05-25 12:51:16 -04:00
gtp.c net: fix potential null pointer dereference 2017-05-25 12:54:02 -04:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c
macvlan.c macvlan: Fix performance issues with vlan tagged packets 2017-05-15 14:18:11 -04:00
macvtap.c
Makefile
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
tun.c
veth.c
virtio_net.c virtio-net: enable TSO/checksum offloads for Q-in-Q vlans 2017-05-24 16:27:14 -04:00
vrf.c driver: vrf: Fix one possible use-after-free issue 2017-05-11 12:13:11 -04:00
vsockmon.c
vxlan.c
xen-netfront.c xen-netfront: avoid crashing on resume after a failure in talk_to_netback() 2017-05-11 21:38:50 -04:00