Skip to content

Commit 45fc134

Browse files
liuhangbinkuba-moo
authored andcommitted
bonding: do not set usable_slaves for broadcast mode
After commit e0caeb2 ("net: bonding: update the slave array for broadcast mode"), broadcast mode will also set all_slaves and usable_slaves during bond_enslave(). But if we also set updelay, during enslave, the slave init state will be BOND_LINK_BACK. And later bond_update_slave_arr() will alloc usable_slaves but add nothing. This will cause bond_miimon_inspect() to have ignore_updelay always true. So the updelay will be always ignored. e.g. [ 6.498368] bond0: (slave veth2): link status definitely down, disabling slave [ 7.536371] bond0: (slave veth2): link status up, enabling it in 0 ms [ 7.536402] bond0: (slave veth2): link status definitely up, 10000 Mbps full duplex To fix it, we can either always call bond_update_slave_arr() on every place when link changes. Or, let's just not set usable_slaves for broadcast mode. Fixes: e0caeb2 ("net: bonding: update the slave array for broadcast mode") Reported-by: Liang Li <[email protected]> Signed-off-by: Hangbin Liu <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 224a0d2 commit 45fc134

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

drivers/net/bonding/bond_main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5069,13 +5069,18 @@ static void bond_set_slave_arr(struct bonding *bond,
50695069
{
50705070
struct bond_up_slave *usable, *all;
50715071

5072-
usable = rtnl_dereference(bond->usable_slaves);
5073-
rcu_assign_pointer(bond->usable_slaves, usable_slaves);
5074-
kfree_rcu(usable, rcu);
5075-
50765072
all = rtnl_dereference(bond->all_slaves);
50775073
rcu_assign_pointer(bond->all_slaves, all_slaves);
50785074
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);
50795084
}
50805085

50815086
static void bond_reset_slave_arr(struct bonding *bond)

0 commit comments

Comments
 (0)