Commit 21c9d8d7 authored by Jay Vosburgh's avatar Jay Vosburgh Committed by David S. Miller

bonding: do not acquire rtnl in ARP monitor

	The ARP monitor functions currently acquire RTNL when performing
failover operations, but do so incorrectly (out of order).  This causes
various warnings from might_sleep.

	The ARP monitor isn't supported for any of the bonding modes
that actually require RTNL, so it is safe to not hold RTNL when
failing over in the ARP monitor.
Signed-off-by: default avatarJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2439f9eb
...@@ -2801,14 +2801,11 @@ void bond_loadbalance_arp_mon(struct work_struct *work) ...@@ -2801,14 +2801,11 @@ void bond_loadbalance_arp_mon(struct work_struct *work)
} }
if (do_failover) { if (do_failover) {
rtnl_lock();
write_lock_bh(&bond->curr_slave_lock); write_lock_bh(&bond->curr_slave_lock);
bond_select_active_slave(bond); bond_select_active_slave(bond);
write_unlock_bh(&bond->curr_slave_lock); write_unlock_bh(&bond->curr_slave_lock);
rtnl_unlock();
} }
re_arm: re_arm:
...@@ -2865,8 +2862,6 @@ void bond_activebackup_arp_mon(struct work_struct *work) ...@@ -2865,8 +2862,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
slave->link = BOND_LINK_UP; slave->link = BOND_LINK_UP;
rtnl_lock();
write_lock_bh(&bond->curr_slave_lock); write_lock_bh(&bond->curr_slave_lock);
if ((!bond->curr_active_slave) && if ((!bond->curr_active_slave) &&
...@@ -2902,7 +2897,6 @@ void bond_activebackup_arp_mon(struct work_struct *work) ...@@ -2902,7 +2897,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
} }
write_unlock_bh(&bond->curr_slave_lock); write_unlock_bh(&bond->curr_slave_lock);
rtnl_unlock();
} }
} else { } else {
read_lock(&bond->curr_slave_lock); read_lock(&bond->curr_slave_lock);
...@@ -2972,7 +2966,6 @@ void bond_activebackup_arp_mon(struct work_struct *work) ...@@ -2972,7 +2966,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
bond->dev->name, bond->dev->name,
slave->dev->name); slave->dev->name);
rtnl_lock();
write_lock_bh(&bond->curr_slave_lock); write_lock_bh(&bond->curr_slave_lock);
bond_select_active_slave(bond); bond_select_active_slave(bond);
...@@ -2980,8 +2973,6 @@ void bond_activebackup_arp_mon(struct work_struct *work) ...@@ -2980,8 +2973,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
write_unlock_bh(&bond->curr_slave_lock); write_unlock_bh(&bond->curr_slave_lock);
rtnl_unlock();
bond->current_arp_slave = slave; bond->current_arp_slave = slave;
if (slave) { if (slave) {
...@@ -2999,13 +2990,10 @@ void bond_activebackup_arp_mon(struct work_struct *work) ...@@ -2999,13 +2990,10 @@ void bond_activebackup_arp_mon(struct work_struct *work)
bond->primary_slave->dev->name); bond->primary_slave->dev->name);
/* primary is up so switch to it */ /* primary is up so switch to it */
rtnl_lock();
write_lock_bh(&bond->curr_slave_lock); write_lock_bh(&bond->curr_slave_lock);
bond_change_active_slave(bond, bond->primary_slave); bond_change_active_slave(bond, bond->primary_slave);
write_unlock_bh(&bond->curr_slave_lock); write_unlock_bh(&bond->curr_slave_lock);
rtnl_unlock();
slave = bond->primary_slave; slave = bond->primary_slave;
slave->jiffies = jiffies; slave->jiffies = jiffies;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment