bonding: rebuild the lock use for bond_activebackup_arp_mon()
authordingtianhong <dingtianhong@huawei.com>
Fri, 13 Dec 2013 02:20:02 +0000 (10:20 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 14 Dec 2013 06:58:02 +0000 (01:58 -0500)
commiteb9fa4b0199f62df3d174d32b4bd534df8ba4533
treed5ce36e8379818ff29a0d53b1c13e81a14efc183
parente001bfad913bf119fb67c1e8dd2d4ec1f5d392fa
bonding: rebuild the lock use for bond_activebackup_arp_mon()

The bond_activebackup_arp_mon() use the bond lock for read to
protect the slave list, it is no effect, and the RTNL is only
called for bond_ab_arp_commit() and peer notify, for the performance
better, use RCU to replace with the bond lock, to the bond slave
list need to called in RCU, add a new bond_first_slave_rcu()
to get the first slave in RCU protection.

In bond_ab_arp_probe(), the bond->current_arp_slave may changd
if bond release slave, just like:

        bond_ab_arp_probe()                     bond_release()
        cpu 0                                   cpu 1
        ...
        if (bond->current_arp_slave...)         ...
        ...                             bond->current_arp_slave = NULl
        bond->current_arp_slave->dev->name      ...

So the current_arp_slave need to dereference in the section.

Suggested-by: Nikolay Aleksandrov <nikolay@redhat.com>
Suggested-by: Jay Vosburgh <fubar@us.ibm.com>
Suggested-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c