• D
    bonding: add RCU for bond_3ad_state_machine_handler() · be79bd04
    dingtianhong 提交于
    The bond_3ad_state_machine_handler() use the bond lock to protect
    the bond slave list and slave port together, but it is not enough,
    the bond slave list was link and unlink in RTNL, not bond lock,
    so I add RCU to protect the slave list from leaving.
    
    The bond lock is still used here, because when the slave has been
    removed from the list by the time the state machine runs, it appears
    to be possible for both function to manupulate the same aggregator->lag_ports
    by finding the aggregator via two different ports that are both members of
    that aggregator (i.e., port A of the agg is being unbound, and port B
    of the agg is runing its state machine).
    
    If I remove the bond lock, there are nothing to mutex changes
    to aggregator->lag_ports between bond_3ad_state_machine_handler and
    bond_3ad_unbind_slave, So the bond lock is the simplest way to protect
    aggregator->lag_ports.
    
    There was a lot of function need RCU protect, I have two choice
    to make the function in RCU-safe, (1) create new similar functions
    and make the bond slave list in RCU. (2) modify the existed functions
    and make them in read-side critical section, because the RCU
    read-side critical sections may be nested.
    
    I choose (2) because it is no need to create more similar functions.
    
    The nots in the function is still too old, clean up the nots.
    Suggested-by: NNikolay Aleksandrov <nikolay@redhat.com>
    Suggested-by: NJay Vosburgh <fubar@us.ibm.com>
    Suggested-by: NVeaceslav Falico <vfalico@redhat.com>
    Signed-off-by: NDing Tianhong <dingtianhong@huawei.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    be79bd04
bond_3ad.c 79.8 KB