* [PATCH net 1/3] Revert "bonding: do not set usable_slaves for broadcast mode"
2026-11-26 2:30 [PATCH net 0/3] bonding: ignore updelay when no active links for broadcast mode Hangbin Liu
@ 2026-11-26 2:30 ` Hangbin Liu
2026-11-26 2:30 ` [PATCH net 2/3] bonding: update slave array on link change for broadcast mode Hangbin Liu
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2026-11-26 2:30 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>
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@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] 5+ messages in thread* [PATCH net 2/3] bonding: update slave array on link change for broadcast mode
2026-11-26 2:30 [PATCH net 0/3] bonding: ignore updelay when no active links for broadcast mode Hangbin Liu
2026-11-26 2:30 ` [PATCH net 1/3] Revert "bonding: do not set usable_slaves for broadcast mode" Hangbin Liu
@ 2026-11-26 2:30 ` Hangbin Liu
2026-11-26 2:30 ` [PATCH net 3/3] selftests: bonding: add recovery updelay test " Hangbin Liu
2026-11-26 2:32 ` [PATCH net 0/3] bonding: ignore updelay when no active links " netdev-bot+sinfo
3 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2026-11-26 2:30 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>
bond_miimon_link_change() rebuilds the slave array when a slave's
link state changes, but it has no broadcast case, so broadcast only
rebuilds usable_slaves on enslave/release. bond_miimon_inspect()
then derives ignore_updelay from a stale snapshot:
- if the last rebuild ran while no slave was can_tx (common for
batch enslave with updelay, since new slaves start in
BOND_LINK_BACK), the snapshot keeps count == 0 forever and
updelay is never honored, even once other slaves are usable;
- if the snapshot still lists a slave that has since gone down,
ignore_updelay stays false and updelay delays recovery even
when the bond has no usable links, contrary to section 13.1
paragraph 4 of the bonding documentation.
Add the broadcast case so the snapshot follows link transitions the
same way balance-xor does. This needs the revert of 45fc134bcfad as
a prerequisite: with 45fc134bcfad applied, bond_set_slave_arr()
discards the refreshed array for broadcast.
Fixes: e0caeb24f538 ("net: bonding: update the slave array for broadcast mode")
Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
---
drivers/net/bonding/bond_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d6675e87d06b..b1efbdf597ec 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;
}
--
2.56.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH net 3/3] selftests: bonding: add recovery updelay test for broadcast mode
2026-11-26 2:30 [PATCH net 0/3] bonding: ignore updelay when no active links for broadcast mode Hangbin Liu
2026-11-26 2:30 ` [PATCH net 1/3] Revert "bonding: do not set usable_slaves for broadcast mode" Hangbin Liu
2026-11-26 2:30 ` [PATCH net 2/3] bonding: update slave array on link change for broadcast mode Hangbin Liu
@ 2026-11-26 2:30 ` Hangbin Liu
2026-11-26 2:32 ` [PATCH net 0/3] bonding: ignore updelay when no active links " netdev-bot+sinfo
3 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2026-11-26 2:30 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] 5+ messages in thread* Re: [PATCH net 0/3] bonding: ignore updelay when no active links for broadcast mode
2026-11-26 2:30 [PATCH net 0/3] bonding: ignore updelay when no active links for broadcast mode Hangbin Liu
` (2 preceding siblings ...)
2026-11-26 2:30 ` [PATCH net 3/3] selftests: bonding: add recovery updelay test " Hangbin Liu
@ 2026-11-26 2:32 ` netdev-bot+sinfo
3 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sinfo @ 2026-11-26 2:32 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
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] 5+ messages in thread