bonding: fix bond recovery in mode 2
Subsystems (4)
v2 cover bonding: fix bond recovery in mode 2
When a bond is configured with a non-zero updelay and in mode 2 the bond never recovers after all slaves lose link. The first patch adds selftests that demonstrate the issue and the second patch fixes the issue by ignoring the updelay when there are no usable slaves.
v2:
* repost to net tree, suggested by Paolo Abeni
* reduce number of icmp echos used in test, suggested by Paolo Abeni
Jonathan Toppins (2):
selftests: bonding: up/down delay w/ slave link flapping
bonding: fix link recovery in mode 2 when updelay is nonzero
drivers/net/bonding/bond_main.c | 11 +- .../selftests/drivers/net/bonding/Makefile | 4 +- .../selftests/drivers/net/bonding/lag_lib.sh | 106 ++++++++++++++++++ .../net/bonding/mode-1-recovery-updelay.sh | 45 ++++++++ .../net/bonding/mode-2-recovery-updelay.sh | 45 ++++++++ .../selftests/drivers/net/bonding/settings | 2 +- 6 files changed, 210 insertions(+), 3 deletions(-) create mode 100755 tools/testing/selftests/drivers/net/bonding/mode-1-recovery-updelay.sh create mode 100755 tools/testing/selftests/drivers/net/bonding/mode-2-recovery-updelay.sh
Signature · 1 line
2.31.1
PATCH v2 1/2 selftests: bonding: up/down delay w/ slave link flapping
Verify when a bond is configured with {up,down}delay 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)
---
Notes:
v2:
* reduced the number of icmp echos to two (-c 2) and removed the unneeded return 0 from function test_bond_recovery.
.../selftests/drivers/net/bonding/Makefile | 4 +- .../selftests/drivers/net/bonding/lag_lib.sh | 106 ++++++++++++++++++ .../net/bonding/mode-1-recovery-updelay.sh | 45 ++++++++ .../net/bonding/mode-2-recovery-updelay.sh | 45 ++++++++ .../selftests/drivers/net/bonding/settings | 2 +- 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100755 tools/testing/selftests/drivers/net/bonding/mode-1-recovery-updelay.sh create mode 100755 tools/testing/selftests/drivers/net/bonding/mode-2-recovery-updelay.sh
tools/testing/selftests/drivers/net/bonding/Makefile +3 -1
@@ -5,7 +5,9 @@ TEST_PROGS := \ bond-arp-interval-causes-panic.sh \ bond-break-lacpdu-tx.sh \ bond-lladdr-target.sh \ - dev_addr_lists.sh + dev_addr_lists.sh \ + mode-1-recovery-updelay.sh \ + mode-2-recovery-updelay.sh TEST_FILES := \ lag_lib.sh \
tools/testing/selftests/drivers/net/bonding/lag_lib.sh +106 -0
115 lines not on this page · raw message
tools/testing/selftests/drivers/net/bonding/mode-1-recovery-updelay.sh new file +45 -0
45 lines not on this page · raw message
tools/testing/selftests/drivers/net/bonding/mode-2-recovery-updelay.sh new file +45 -0
45 lines not on this page · raw message
tools/testing/selftests/drivers/net/bonding/settings +1 -1
@@ -1 +1 @@ -timeout=60 +timeout=120
Signature · 1 line
2.31.1
PATCH v2 2/2 bonding: fix link recovery in mode 2 when updelay is nonzero
In reply to Jonathan ToppinsBefore this change when a bond in mode 2 lost link, all of its slaves lost link, the bonding device would never recover even after the expiration of updelay. This change removes the updelay when the bond currently has no usable links. Conforming to bonding.txt section 13.1 paragraph 4.
---
Notes:
v2:
* added fixes tag and reposted to net tree
drivers/net/bonding/bond_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +10 -1
@@ -2536,7 +2536,16 @@ static int bond_miimon_inspect(struct bonding *bond)struct slave *slave;bool ignore_updelay; - ignore_updelay = !rcu_dereference (bond->curr_active_slave); +if (BOND_MODE (bond) ==BOND_MODE_ACTIVEBACKUP ) { + ignore_updelay = !rcu_dereference (bond->curr_active_slave); + }else { +struct bond_up_slave *usable_slaves; + + usable_slaves =rcu_dereference (bond->usable_slaves); + +if (usable_slaves && usable_slaves->count ==0 ) + ignore_updelay = true; + }bond_for_each_slave_rcu (bond, slave, iter) {bond_propose_link_state (slave,BOND_LINK_NOCHANGE );
Signature · 1 line
2.31.1
Re: [PATCH net-next v2 2/2] bonding: fix link recovery in mode 2 when updelay is nonzero
Quoted 8 lines · Jonathan Toppins
Before this change when a bond in mode 2 lost link, all of its slaves lost link, the bonding device would never recover even after the expiration of updelay. This change removes the updelay when the bond currently has no usable links. Conforming to bonding.txt section 13.1 paragraph 4.
Fixes 41f891004063 ("bonding: ignore updelay param when there is no active slave")Signed-off-by Jonathan Toppins <[email protected]>
This looks correct, although I suspect it would affect more than
just balance-xor ("mode 2"); if memory serves, balance-rr mode operates similarly.
-J
Quoted 34 lines
---
Notes:
v2:
* added fixes tag and reposted to net tree
drivers/net/bonding/bond_main.c| 11 ++++++++++-1 file changed, 10 insertions(+), 1 deletion(-)drivers/net/bonding/bond_main.c +10
-1@@ -2536,7 +2536,16 @@ static int bond_miimon_inspect(struct bonding *bond)struct slave *slave;bool ignore_updelay; - ignore_updelay = !rcu_dereference (bond->curr_active_slave); +if (BOND_MODE (bond) ==BOND_MODE_ACTIVEBACKUP ) { + ignore_updelay = !rcu_dereference (bond->curr_active_slave); + }else { +struct bond_up_slave *usable_slaves; + + usable_slaves =rcu_dereference (bond->usable_slaves); + +if (usable_slaves && usable_slaves->count ==0 ) + ignore_updelay = true; + }bond_for_each_slave_rcu (bond, slave, iter) {bond_propose_link_state (slave,BOND_LINK_NOCHANGE );Signature · 1 line
2.31.1
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Tue, 22 Nov 2022 15:25:03 -0500 you wrote:
When a bond is configured with a non-zero updelay and in mode 2 the bond never recovers after all slaves lose link. The first patch adds selftests that demonstrate the issue and the second patch fixes the issue by ignoring the updelay when there are no usable slaves.
v2:
* repost to net tree, suggested by Paolo Abeni
* reduce number of icmp echos used in test, suggested by Paolo Abeni[...]
Here is the summary with links:
- [net-next,v2,1/2] selftests: bonding: up/down delay w/ slave link flapping
https://git.kernel.org/netdev/net-next/c/d43eff0b85ae - [net-next,v2,2/2] bonding: fix link recovery in mode 2 when updelay is nonzero https://git.kernel.org/netdev/net-next/c/f8a65ab2f3ff
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html