diff options
author | Ding Tianhong <dingtianhong@huawei.com> | 2014-01-28 04:48:53 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-29 08:48:33 +0100 |
commit | 6fde8f037e604e05df1529e4689041715d6d55d2 (patch) | |
tree | 4cdf943fb2d475899f0a0d5a40cd4002184faff1 /drivers/net/bonding/bonding.h | |
parent | tun: add device name(iff) field to proc fdinfo entry (diff) | |
download | linux-6fde8f037e604e05df1529e4689041715d6d55d2.tar.xz linux-6fde8f037e604e05df1529e4689041715d6d55d2.zip |
bonding: fix locking in bond_loadbalance_arp_mon()
The commit 1d3ee88ae0d605629bf369
(bonding: add netlink attributes to slave link dev)
has add rtmsg_ifinfo() in bond_set_active_slave() and
bond_set_backup_slave(), so the two function need to
called in RTNL lock, but bond_loadbalance_arp_mon()
only calling these functions in RCU, warning message
will occurs.
fix this by add a new function bond_slave_state_change(),
which will reset the slave's state after slave link check,
so remove the bond_set_xxx_slave() from the cycle and only
record the slave_state_changed, this will call the new
function to set all slaves to new state in RTNL later.
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/bonding/bonding.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 1a9062f4e0d6..86ccfb9f71cc 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h @@ -303,6 +303,19 @@ static inline void bond_set_backup_slave(struct slave *slave) } } +static inline void bond_slave_state_change(struct bonding *bond) +{ + struct list_head *iter; + struct slave *tmp; + + bond_for_each_slave(bond, tmp, iter) { + if (tmp->link == BOND_LINK_UP) + bond_set_active_slave(tmp); + else if (tmp->link == BOND_LINK_DOWN) + bond_set_backup_slave(tmp); + } +} + static inline int bond_slave_state(struct slave *slave) { return slave->backup; |