Commit 0edce478 authored by Veaceslav Falico's avatar Veaceslav Falico Committed by Ben Hutchings

bonding: don't call update_speed_duplex() under spinlocks

[ Upstream commit 876254ae ]

bond_update_speed_duplex() might sleep while calling underlying slave's
routines. Move it out of atomic context in bond_enslave() and remove it
from bond_miimon_commit() - it was introduced by commit 546add79, however
when the slave interfaces go up/change state it's their responsibility to
fire NETDEV_UP/NETDEV_CHANGE events so that bonding can properly update
their speed.

I've tested it on all combinations of ifup/ifdown, autoneg/speed/duplex
changes, remote-controlled and local, on (not) MII-based cards. All changes
are visible.
Signed-off-by: default avatarVeaceslav Falico <vfalico@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent ec207c10
...@@ -1715,6 +1715,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1715,6 +1715,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
bond_compute_features(bond); bond_compute_features(bond);
bond_update_speed_duplex(new_slave);
read_lock(&bond->lock); read_lock(&bond->lock);
new_slave->last_arp_rx = jiffies; new_slave->last_arp_rx = jiffies;
...@@ -1758,8 +1760,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1758,8 +1760,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
new_slave->link = BOND_LINK_DOWN; new_slave->link = BOND_LINK_DOWN;
} }
bond_update_speed_duplex(new_slave);
if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) {
/* if there is a primary slave, remember it */ /* if there is a primary slave, remember it */
if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { if (strcmp(bond->params.primary, new_slave->dev->name) == 0) {
...@@ -2437,8 +2437,6 @@ static void bond_miimon_commit(struct bonding *bond) ...@@ -2437,8 +2437,6 @@ static void bond_miimon_commit(struct bonding *bond)
bond_set_backup_slave(slave); bond_set_backup_slave(slave);
} }
bond_update_speed_duplex(slave);
pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n",
bond->dev->name, slave->dev->name, bond->dev->name, slave->dev->name,
slave->speed, slave->duplex ? "full" : "half"); slave->speed, slave->duplex ? "full" : "half");
......
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