[PATCH net 1/3] Revert "bonding: do not set usable_slaves for broadcast mode"

From: Hangbin Liu

Date: Wed Nov 25 2026 - 21:31:39 EST


From: Hangbin Liu <liuhangbin@xxxxxxxxxx>

This reverts commit 45fc134bcfadde456639c1b1e206e6918d69a553.

Commit 45fc134bcfad ("bonding: do not set usable_slaves for broadcast mode")
assumes the bond updelay always applies. However, per commit f8a65ab2f3ff
("bonding: fix link recovery in mode 2 when updelay is nonzero") and
section 13.1 paragraph 4 of the bonding documentation, when a slave is
enslaved and there are no active slaves, the slave should become usable
immediately once its link comes up, updelay should be ignored.

Before this revert: with no active interfaces, the only slave still waited
out the 1000 ms updelay before being brought into use.

[ 154.846629] bond0: (slave veth0): link status definitely down, disabling slave
[ 154.849879] bond0: now running without any active interface!
[ 159.544736] bond0: (slave veth0): link status up, enabling it in 1000 ms
[ 160.586299] bond0: (slave veth0): link status definitely up, 10000 Mbps full duplex
[ 160.603278] bond0: active interface up!

After this revert: the first slave can be used immediately on link up.
Subsequent slave veth2 still honor the 1000 ms updelay.

[ 94.106425] bond0: (slave veth0): link status definitely down, disabling slave
[ 94.109130] bond0: now running without any active interface!
[ 98.272494] bond0: (slave veth0): link status up, enabling it in 0 ms
[ 98.273279] bond0: (slave veth0): link status definitely up, 10000 Mbps full duplex
[ 98.275056] bond0: active interface up!
[ 110.855705] bond0: (slave veth2): Enslaving as an active interface with an up link
[ 111.904688] bond0: (slave veth2): link status definitely up, 10000 Mbps full duplex
[ 114.608488] bond0: (slave veth2): link status definitely down, disabling slave
[ 117.624491] bond0: (slave veth2): link status up, enabling it in 1000 ms
[ 118.664636] bond0: (slave veth2): link status definitely up, 10000 Mbps full duplex

The stale-empty side of the problem that motivated 45fc134bcfad is
addressed by the follow-up patch in this series, "bonding: update
slave array on link change for broadcast mode", which rebuilds the
array on link transitions, together they keep ignore_updelay correct
in both directions.

Signed-off-by: Hangbin Liu <liuhangbin@xxxxxxxxxx>
---
drivers/net/bonding/bond_main.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 042d7c75548f..d6675e87d06b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5140,18 +5140,13 @@ static void bond_set_slave_arr(struct bonding *bond,
{
struct bond_up_slave *usable, *all;

- all = rtnl_dereference(bond->all_slaves);
- rcu_assign_pointer(bond->all_slaves, all_slaves);
- kfree_rcu(all, rcu);
-
- if (BOND_MODE(bond) == BOND_MODE_BROADCAST) {
- kfree_rcu(usable_slaves, rcu);
- return;
- }
-
usable = rtnl_dereference(bond->usable_slaves);
rcu_assign_pointer(bond->usable_slaves, usable_slaves);
kfree_rcu(usable, rcu);
+
+ all = rtnl_dereference(bond->all_slaves);
+ rcu_assign_pointer(bond->all_slaves, all_slaves);
+ kfree_rcu(all, rcu);
}

static void bond_reset_slave_arr(struct bonding *bond)

--
2.56.0