• Mahesh Bandewar's avatar
    bonding: improve link-status update in mii-monitoring · de77ecd4
    Mahesh Bandewar authored
    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: default avatarMahesh Bandewar <maheshb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    de77ecd4
bond_main.c 133 KB