]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
bonding: improve link-status update in mii-monitoring
authorMahesh Bandewar <maheshb@google.com>
Mon, 27 Mar 2017 18:37:33 +0000 (11:37 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 28 Mar 2017 04:11:49 +0000 (21:11 -0700)
commitde77ecd4ef02ca783f7762e04e92b3d0964be66b
tree9c60b36e20036731d3a425a02cf2fd44b45b2e26
parentf307668bfcb7e83b6f62bda6a703e09613a00bd0
bonding: improve link-status update in mii-monitoring

The primary issue is that mii-inspect phase updates link-state and
expects changes to be committed during the mii-commit phase. After
the inspect phase if it fails to acquire rtnl-mutex, the commit
phase (bond_mii_commit) doesn't get to run. This partially updated
state stays and makes the internal-state inconsistent.

e.g. setup bond0 => slaves: eth1, eth2
eth1 goes DOWN -> UP
   mii_monitor()
mii-inspect()
    bond_set_slave_link_state(eth1, UP, DontNotify)
rtnl_trylock() <- fails!

Next mii-monitor round
eth1: No change
   mii_monitor()
mii-inspect()
    eth1->link == current-status (ethtool_ops->get_link)
    no-change-detected

End result:
    eth1:
      Link = BOND_LINK_UP
      Speed = 0xfffff  [SpeedUnknown]
      Duplex = 0xff    [DuplexUnknown]

This doesn't always happen but for some unlucky machines in a large set
of machines it creates problems.

The fix for this is to avoid making changes during inspect phase and
postpone them until acquiring the rtnl-mutex / invoking commit phase.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c