Skip to content

Commit 876254a

Browse files
Veaceslav Falicodavem330
authored andcommitted
bonding: don't call update_speed_duplex() under spinlocks
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 546add7, 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: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d35162f commit 876254a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
17461746

17471747
bond_compute_features(bond);
17481748

1749+
bond_update_speed_duplex(new_slave);
1750+
17491751
read_lock(&bond->lock);
17501752

17511753
new_slave->last_arp_rx = jiffies -
@@ -1798,8 +1800,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
17981800
new_slave->link == BOND_LINK_DOWN ? "DOWN" :
17991801
(new_slave->link == BOND_LINK_UP ? "UP" : "BACK"));
18001802

1801-
bond_update_speed_duplex(new_slave);
1802-
18031803
if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) {
18041804
/* if there is a primary slave, remember it */
18051805
if (strcmp(bond->params.primary, new_slave->dev->name) == 0) {
@@ -2374,8 +2374,6 @@ static void bond_miimon_commit(struct bonding *bond)
23742374
bond_set_backup_slave(slave);
23752375
}
23762376

2377-
bond_update_speed_duplex(slave);
2378-
23792377
pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n",
23802378
bond->dev->name, slave->dev->name,
23812379
slave->speed, slave->duplex ? "full" : "half");

0 commit comments

Comments
 (0)