Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'bond-fix-2-link-state-issues'

Hangbin Liu says:

====================
bond: fix 2 link state issues

This patch set fixes two bonding link state issues:

1. Broadcast mode incorrectly sets usable_slaves, causing updelay to be ignored
2. BOND_LINK_FAIL and BOND_LINK_BACK are treated as invalid states, generating
confusing error messages

Here is the reproducer:

```
ip netns add ns
ip -n ns link add bond0 type bond mode 3 miimon 100 updelay 200 downdelay 200
ip -n ns link add type veth
ip -n ns link add type veth
ip -n ns link set veth1 up
ip -n ns link set veth3 up
ip -n ns link set veth0 master bond0
ip -n ns link set veth2 master bond0
ip -n ns link set bond0 up
sleep 1
ip -n ns link set veth3 down
sleep 1
ip -n ns link set veth3 up
sleep 1
dmesg | tail
```
====================

Link: https://patch.msgid.link/20260304-b4-bond_updelay-v1-0-f72eb2e454d0@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+16 -5
+16 -5
drivers/net/bonding/bond_main.c
··· 2801 2801 2802 2802 continue; 2803 2803 2804 + case BOND_LINK_FAIL: 2805 + case BOND_LINK_BACK: 2806 + slave_dbg(bond->dev, slave->dev, "link_new_state %d on slave\n", 2807 + slave->link_new_state); 2808 + continue; 2809 + 2804 2810 default: 2805 - slave_err(bond->dev, slave->dev, "invalid new link %d on slave\n", 2811 + slave_err(bond->dev, slave->dev, "invalid link_new_state %d on slave\n", 2806 2812 slave->link_new_state); 2807 2813 bond_propose_link_state(slave, BOND_LINK_NOCHANGE); 2808 2814 ··· 5075 5069 { 5076 5070 struct bond_up_slave *usable, *all; 5077 5071 5078 - usable = rtnl_dereference(bond->usable_slaves); 5079 - rcu_assign_pointer(bond->usable_slaves, usable_slaves); 5080 - kfree_rcu(usable, rcu); 5081 - 5082 5072 all = rtnl_dereference(bond->all_slaves); 5083 5073 rcu_assign_pointer(bond->all_slaves, all_slaves); 5084 5074 kfree_rcu(all, rcu); 5075 + 5076 + if (BOND_MODE(bond) == BOND_MODE_BROADCAST) { 5077 + kfree_rcu(usable_slaves, rcu); 5078 + return; 5079 + } 5080 + 5081 + usable = rtnl_dereference(bond->usable_slaves); 5082 + rcu_assign_pointer(bond->usable_slaves, usable_slaves); 5083 + kfree_rcu(usable, rcu); 5085 5084 } 5086 5085 5087 5086 static void bond_reset_slave_arr(struct bonding *bond)