* [PATCH net v2 1/3] Revert "bonding: do not set usable_slaves for broadcast mode"
2026-12-01 6:29 [PATCH net v2 0/3] bonding: ignore updelay when no active links for broadcast mode Hangbin Liu
@ 2026-12-01 6:29 ` Hangbin Liu
2026-12-01 6:29 ` [PATCH net v2 2/3] bonding: update slave array on link change for broadcast mode Hangbin Liu
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Hangbin Liu @ 2026-12-01 6:29 UTC (permalink / raw)
To: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tonghao Zhang, Nikolay Aleksandrov,
Shuah Khan
Cc: jiangjiehua (A),
Hangbin Liu, netdev, linux-kernel, linux-kselftest, Hangbin Liu,
stable
From: Hangbin Liu <liuhangbin@kylinos.cn>
This reverts commit 45fc134bcfadde456639c1b1e206e6918d69a553.
The reverted commit 45fc134bcfad ("bonding: do not set usable_slaves for
broadcast mode") assumes the bond updelay always applies. However, based
on bonding.rst section 13.1 paragraph 4 and commit f8a65ab2f3ff ("bonding:
fix link recovery in mode 2 when updelay is nonzero"), 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 revert this one 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.
Cc: stable@vger.kernel.org
Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
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
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH net v2 2/3] bonding: update slave array on link change for broadcast mode
2026-12-01 6:29 [PATCH net v2 0/3] bonding: ignore updelay when no active links for broadcast mode Hangbin Liu
2026-12-01 6:29 ` [PATCH net v2 1/3] Revert "bonding: do not set usable_slaves for broadcast mode" Hangbin Liu
@ 2026-12-01 6:29 ` Hangbin Liu
2026-12-01 6:29 ` [PATCH net v2 3/3] selftests: bonding: add recovery updelay test " Hangbin Liu
2026-12-01 6:34 ` [PATCH net v2 0/3] bonding: ignore updelay when no active links " netdev-bot+sinfo
3 siblings, 0 replies; 6+ messages in thread
From: Hangbin Liu @ 2026-12-01 6:29 UTC (permalink / raw)
To: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tonghao Zhang, Nikolay Aleksandrov,
Shuah Khan
Cc: jiangjiehua (A),
Hangbin Liu, netdev, linux-kernel, linux-kselftest, Hangbin Liu,
stable
From: Hangbin Liu <liuhangbin@kylinos.cn>
The MII monitor uses the usable-slave array to decide whether to
bypass updelay. When no slave can transmit, the first recovering
slave should become usable without waiting for updelay (bonding.rst
section 13.1 paragraph 4). When another slave can still transmit,
the recovering slave should wait.
In broadcast mode, the array is rebuilt when a slave is added or
removed, but not when its link state changes. A stale empty array can
make a recovering slave bypass updelay while another slave is still
forwarding. A stale nonempty array can make the first recovering
slave wait even though no slave can transmit.
Rebuild the arrays upon MII link-state changes. The ARP monitor
`bond_loadbalance_arp_mon` also needs to be updated, since the bonding
monitor mode may be changed at runtime. Apply the same logic in
`bond_open()` and `bond_slave_netdev_event()`.
This relies on the preceding revert of commit 45fc134bcfad ("bonding: do
not set usable_slaves for broadcast mode") to publish the refreshed
usable-slave array.
Fixes: e0caeb24f538 ("net: bonding: update the slave array for broadcast mode")
Cc: stable@vger.kernel.org
Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
For Sashiko:
When the bond mode switch from balance-xor to balance-rr, or broadcast
to balance-rr, the published usable_slaves is not changed. This is
issue for balance-rr and will be addressed in another patch.
---
drivers/net/bonding/bond_main.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d6675e87d06b..a8c79fa9f5bf 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2780,6 +2780,7 @@ static void bond_miimon_link_change(struct bonding *bond,
bond_alb_handle_link_change(bond, slave, link);
break;
case BOND_MODE_XOR:
+ case BOND_MODE_BROADCAST:
bond_update_slave_arr(bond, NULL);
break;
}
@@ -3588,7 +3589,8 @@ static void bond_loadbalance_arp_mon(struct bonding *bond)
if (slave_state_changed) {
bond_slave_state_change(bond);
- if (BOND_MODE(bond) == BOND_MODE_XOR)
+ if (BOND_MODE(bond) == BOND_MODE_XOR ||
+ BOND_MODE(bond) == BOND_MODE_BROADCAST)
bond_update_slave_arr(bond, NULL);
}
if (do_failover) {
@@ -4010,7 +4012,8 @@ static int bond_slave_netdev_event(unsigned long event,
* events. If these (miimon/arpmon) parameters are configured
* then array gets refreshed twice and that should be fine!
*/
- if (bond_mode_can_use_xmit_hash(bond))
+ if (bond_mode_can_use_xmit_hash(bond) ||
+ BOND_MODE(bond) == BOND_MODE_BROADCAST)
bond_update_slave_arr(bond, NULL);
break;
case NETDEV_CHANGEMTU:
@@ -4411,7 +4414,8 @@ static int bond_open(struct net_device *bond_dev)
static_branch_inc(&bond_bcast_neigh_enabled);
}
- if (bond_mode_can_use_xmit_hash(bond))
+ if (bond_mode_can_use_xmit_hash(bond) ||
+ BOND_MODE(bond) == BOND_MODE_BROADCAST)
bond_update_slave_arr(bond, NULL);
return 0;
--
2.56.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH net v2 3/3] selftests: bonding: add recovery updelay test for broadcast mode
2026-12-01 6:29 [PATCH net v2 0/3] bonding: ignore updelay when no active links for broadcast mode Hangbin Liu
2026-12-01 6:29 ` [PATCH net v2 1/3] Revert "bonding: do not set usable_slaves for broadcast mode" Hangbin Liu
2026-12-01 6:29 ` [PATCH net v2 2/3] bonding: update slave array on link change for broadcast mode Hangbin Liu
@ 2026-12-01 6:29 ` Hangbin Liu
2026-12-01 6:34 ` [PATCH net v2 0/3] bonding: ignore updelay when no active links " netdev-bot+sinfo
3 siblings, 0 replies; 6+ messages in thread
From: Hangbin Liu @ 2026-12-01 6:29 UTC (permalink / raw)
To: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tonghao Zhang, Nikolay Aleksandrov,
Shuah Khan
Cc: jiangjiehua (A),
Hangbin Liu, netdev, linux-kernel, linux-kselftest, Hangbin Liu
From: Hangbin Liu <liuhangbin@kylinos.cn>
Add a recovery updelay test for bonding mode 3. Merge all related tests
into a single test file.
Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
.../testing/selftests/drivers/net/bonding/Makefile | 3 +-
.../drivers/net/bonding/mode-2-recovery-updelay.sh | 45 ----------------------
...e-1-recovery-updelay.sh => recovery-updelay.sh} | 13 +++----
3 files changed, 7 insertions(+), 54 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/bonding/Makefile b/tools/testing/selftests/drivers/net/bonding/Makefile
index e337c099fb40..c186310c2d6e 100644
--- a/tools/testing/selftests/drivers/net/bonding/Makefile
+++ b/tools/testing/selftests/drivers/net/bonding/Makefile
@@ -15,9 +15,8 @@ TEST_PROGS := \
bond_stacked_header_parse.sh \
bond_vlan_real_dev.sh \
dev_addr_lists.sh \
- mode-1-recovery-updelay.sh \
- mode-2-recovery-updelay.sh \
netcons_over_bonding.sh \
+ recovery-updelay.sh \
# end of TEST_PROGS
TEST_FILES := \
diff --git a/tools/testing/selftests/drivers/net/bonding/mode-2-recovery-updelay.sh b/tools/testing/selftests/drivers/net/bonding/mode-2-recovery-updelay.sh
deleted file mode 100755
index 2d275b3e47dd..000000000000
--- a/tools/testing/selftests/drivers/net/bonding/mode-2-recovery-updelay.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: GPL-2.0
-
-# Regression Test:
-# When the bond is configured with down/updelay and the link state of
-# slave members flaps if there are no remaining members up the bond
-# should immediately select a member to bring up. (from bonding.txt
-# section 13.1 paragraph 4)
-#
-# +-------------+ +-----------+
-# | client | | switch |
-# | | | |
-# | +--------| link1 |-----+ |
-# | | +-------+ | |
-# | | | | | |
-# | | +-------+ | |
-# | | bond | link2 | Br0 | |
-# +-------------+ +-----------+
-# 172.20.2.1 172.20.2.2
-
-
-REQUIRE_MZ=no
-REQUIRE_JQ=no
-NUM_NETIFS=0
-lib_dir=$(dirname "$0")
-source "$lib_dir"/../../../net/forwarding/lib.sh
-source "$lib_dir"/lag_lib.sh
-
-cleanup()
-{
- lag_cleanup
-}
-
-trap cleanup 0 1 2
-
-lag_setup_network
-test_bond_recovery mode 2 miimon 100 updelay 0
-test_bond_recovery mode 2 miimon 100 updelay 200
-test_bond_recovery mode 2 miimon 100 updelay 500
-test_bond_recovery mode 2 miimon 100 updelay 1000
-test_bond_recovery mode 2 miimon 100 updelay 2000
-test_bond_recovery mode 2 miimon 100 updelay 5000
-test_bond_recovery mode 2 miimon 100 updelay 10000
-
-exit "$EXIT_STATUS"
diff --git a/tools/testing/selftests/drivers/net/bonding/mode-1-recovery-updelay.sh b/tools/testing/selftests/drivers/net/bonding/recovery-updelay.sh
similarity index 72%
rename from tools/testing/selftests/drivers/net/bonding/mode-1-recovery-updelay.sh
rename to tools/testing/selftests/drivers/net/bonding/recovery-updelay.sh
index 9d26ab4cad0b..05edf9915cc0 100755
--- a/tools/testing/selftests/drivers/net/bonding/mode-1-recovery-updelay.sh
+++ b/tools/testing/selftests/drivers/net/bonding/recovery-updelay.sh
@@ -34,12 +34,11 @@ cleanup()
trap cleanup 0 1 2
lag_setup_network
-test_bond_recovery mode 1 miimon 100 updelay 0
-test_bond_recovery mode 1 miimon 100 updelay 200
-test_bond_recovery mode 1 miimon 100 updelay 500
-test_bond_recovery mode 1 miimon 100 updelay 1000
-test_bond_recovery mode 1 miimon 100 updelay 2000
-test_bond_recovery mode 1 miimon 100 updelay 5000
-test_bond_recovery mode 1 miimon 100 updelay 10000
+
+for mode in 1 2 3; do
+ for delay in 0 200 500 1000 2000 5000 10000; do
+ test_bond_recovery mode "${mode}" miimon 100 updelay "${delay}"
+ done
+done
exit "$EXIT_STATUS"
--
2.56.0
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net v2 0/3] bonding: ignore updelay when no active links for broadcast mode
2026-12-01 6:29 [PATCH net v2 0/3] bonding: ignore updelay when no active links for broadcast mode Hangbin Liu
` (2 preceding siblings ...)
2026-12-01 6:29 ` [PATCH net v2 3/3] selftests: bonding: add recovery updelay test " Hangbin Liu
@ 2026-12-01 6:34 ` netdev-bot+sinfo
2026-12-01 8:38 ` Hangbin Liu
3 siblings, 1 reply; 6+ messages in thread
From: netdev-bot+sinfo @ 2026-12-01 6:34 UTC (permalink / raw)
To: Hangbin Liu
Cc: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tonghao Zhang, Nikolay Aleksandrov,
Shuah Khan, jiangjiehua (A),
netdev, linux-kernel, linux-kselftest, stable
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net v2 0/3] bonding: ignore updelay when no active links for broadcast mode
2026-12-01 6:34 ` [PATCH net v2 0/3] bonding: ignore updelay when no active links " netdev-bot+sinfo
@ 2026-12-01 8:38 ` Hangbin Liu
0 siblings, 0 replies; 6+ messages in thread
From: Hangbin Liu @ 2026-12-01 8:38 UTC (permalink / raw)
To: netdev-bot+sinfo
Cc: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Tonghao Zhang, Nikolay Aleksandrov,
Shuah Khan, jiangjiehua (A),
netdev, linux-kernel, linux-kselftest, stable
On Tue, Dec 01, 2026 at 06:34:43AM +0000, netdev-bot+sinfo@kernel.org wrote:
> Hi!
>
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
>
> - How the issue was discovered, e.g. hit in production, hit during
> development, syzbot report, manual code inspection, LLM or static
> analysis tool scan.
>
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account.
>
> *IMPORTANT*: If you do repost (for other reasons) - please include
> the relevant info in the cover letter or commit messages.
> --
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.
The issue is found when I review JiangJiehua's patch. I will add this
info (and Jiehua's test by) in cover-letter if there is a new version.
Thanks
Hangbin
^ permalink raw reply [flat|nested] 6+ messages in thread