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

From: netdev-bot+sashiko

Date: Thu Nov 26 2026 - 22:16:12 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] Commit trailer and tagging problems on the revert.
- [Low] Comments no longer match how broadcast mode uses usable_slaves.

--

Revert "bonding: do not set usable_slaves for broadcast mode"

This reverts commit 45fc134bcfad. That commit stopped publishing
bond->usable_slaves in broadcast mode, so updelay was no longer ignored
when there were no active slaves. A follow-up patch in the series
rebuilds the slave array on link changes for broadcast mode.

> Revert "bonding: do not set usable_slaves for broadcast mode"
>
> This reverts commit 45fc134bcfadde456639c1b1e206e6918d69a553.

[ ... ]

> Signed-off-by: Hangbin Liu <liuhangbin@xxxxxxxxxx>

[Severity: Low]
The From: address is Hangbin Liu <hangbin.liu@xxxxxxxxx>, but the
Signed-off-by: address is Hangbin Liu <liuhangbin@xxxxxxxxxx>. Checkpatch
reports this as FROM_SIGN_OFF_MISMATCH. The other two patches in the series
have the same mismatch.

Should this revert carry a Fixes: tag, or a stable dependency note?

Commit 45fc134bcfad went in through net with its own Fixes: e0caeb24f538,
so it has probably reached stable. The follow-up "bonding: update slave
array on link change for broadcast mode" has Fixes: e0caeb24f538 and says
it needs this revert first. None of the tags tell stable tooling about
that ordering.

If only the follow-up is backported, it has no effect. The
bond_set_slave_arr() from 45fc134bcfad still drops usable_slaves for
broadcast mode.

If only this revert is backported, the bug that 45fc134bcfad fixed comes
back: in broadcast mode the stale, empty usable_slaves array makes the
bond always ignore updelay.

> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 042d7c75548fa..d6675e87d06b6 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);

[Severity: Low]
This isn't a bug, but after this revert bond->usable_slaves is published
for BOND_MODE_BROADCAST too. Should the related comments in bond_main.c be
updated to match?

The comment above bond_update_slave_arr() still lists only the xmit-hash
modes:

drivers/net/bonding/bond_main.c:
/* Build the usable slaves array in control path for modes that use xmit-hash
* to determine the slave interface -
* (a) BOND_MODE_8023AD
* (b) BOND_MODE_XOR
* (c) (BOND_MODE_TLB || BOND_MODE_ALB) && tlb_dynamic_lb == 0

The call site in bond_enslave() explains the broadcast case only in terms
of all_slaves:

/* broadcast mode uses the all_slaves to loop through slaves. */
if (bond_mode_can_use_xmit_hash(bond) ||
BOND_MODE(bond) == BOND_MODE_BROADCAST)
bond_update_slave_arr(bond, NULL);

However, bond_miimon_inspect() now relies on the broadcast-mode
usable_slaves to decide ignore_updelay:

usable_slaves = rcu_dereference(bond->usable_slaves);

if (usable_slaves && usable_slaves->count == 0)
ignore_updelay = true;

The rest of the series does not change either comment. Neither comment
says that broadcast mode must keep usable_slaves current on link changes,
which the follow-up patch makes a requirement.

> +
> + all = rtnl_dereference(bond->all_slaves);
> + rcu_assign_pointer(bond->all_slaves, all_slaves);
> + kfree_rcu(all, rcu);
> }

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-bond_broadcast_updelay-v1-0-188e5538d6ca%40kylinos.cn