Commit c4cdef9b authored by dingtianhong's avatar dingtianhong Committed by David S. Miller

bonding: don't call slave_xxx_netpoll under spinlocks

The slave_xxx_netpoll will call synchronize_rcu_bh(),
so the function may schedule and sleep, it should't be
called under spinlocks.

bond_netpoll_setup() and bond_netpoll_cleanup() are always
protected by rtnl lock, it is no need to take the read lock,
as the slave list couldn't be changed outside rtnl lock.
Signed-off-by: default avatarDing Tianhong <dingtianhong@huawei.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f13bbc2f
...@@ -1219,8 +1219,9 @@ static void bond_poll_controller(struct net_device *bond_dev) ...@@ -1219,8 +1219,9 @@ static void bond_poll_controller(struct net_device *bond_dev)
{ {
} }
static void __bond_netpoll_cleanup(struct bonding *bond) static void bond_netpoll_cleanup(struct net_device *bond_dev)
{ {
struct bonding *bond = netdev_priv(bond_dev);
struct slave *slave; struct slave *slave;
int i; int i;
...@@ -1228,14 +1229,6 @@ static void __bond_netpoll_cleanup(struct bonding *bond) ...@@ -1228,14 +1229,6 @@ static void __bond_netpoll_cleanup(struct bonding *bond)
if (IS_UP(slave->dev)) if (IS_UP(slave->dev))
slave_disable_netpoll(slave); slave_disable_netpoll(slave);
} }
static void bond_netpoll_cleanup(struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
read_lock(&bond->lock);
__bond_netpoll_cleanup(bond);
read_unlock(&bond->lock);
}
static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, gfp_t gfp) static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, gfp_t gfp)
{ {
...@@ -1243,15 +1236,13 @@ static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, g ...@@ -1243,15 +1236,13 @@ static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, g
struct slave *slave; struct slave *slave;
int i, err = 0; int i, err = 0;
read_lock(&bond->lock);
bond_for_each_slave(bond, slave, i) { bond_for_each_slave(bond, slave, i) {
err = slave_enable_netpoll(slave); err = slave_enable_netpoll(slave);
if (err) { if (err) {
__bond_netpoll_cleanup(bond); bond_netpoll_cleanup(dev);
break; break;
} }
} }
read_unlock(&bond->lock);
return err; return err;
} }
......
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