[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5PM1z1SEdWFgkui@x130>
Date: Fri, 9 Dec 2022 16:03:35 -0800
From: Saeed Mahameed <saeed@...nel.org>
To: Hangbin Liu <liuhangbin@...il.com>
Cc: netdev@...r.kernel.org, Jay Vosburgh <j.vosburgh@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jonathan Toppins <jtoppins@...hat.com>,
Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>, liali <liali@...hat.com>
Subject: Re: [PATCH net 2/3] bonding: do failover when high prio link up
On 09 Dec 18:13, Hangbin Liu wrote:
>Currently, when a high prio link enslaved, or when current link down,
>the high prio port could be selected. But when high prio link up, the
>new active slave reselection is not triggered. Fix it by checking link's
>prio when getting up.
>
>Reported-by: Liang Li <liali@...hat.com>
>Fixes: 0a2ff7cc8ad4 ("Bonding: add per-port priority for failover re-selection")
>Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
>---
> drivers/net/bonding/bond_main.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 2b6cc4dbb70e..dc6af790ff1e 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -2689,7 +2689,8 @@ static void bond_miimon_commit(struct bonding *bond)
>
> bond_miimon_link_change(bond, slave, BOND_LINK_UP);
>
>- if (!rtnl_dereference(bond->curr_active_slave) || slave == primary)
>+ if (!rtnl_dereference(bond->curr_active_slave) || slave == primary ||
>+ slave->prio > rtnl_dereference(bond->curr_active_slave)->prio)
> goto do_failover;
I am not really familiar with this prio logic, seems to be new.
Anyway, what if one of the next slaves has higher prio than this slave and the
current active ?
I see that the loop over all the slaves continues even after the failover,
but why would you do all these failovers until you settle on the highest
prio one ?
shouldn't you do something similar to bond_choose_primary_or_current()
outside the loop, once you've updated all the slaves link states
Please let me know if I am wandering in the wrong directions
Anyway, LGTM:
Reviewed-by: Saeed Mahameed <saeed@...nel.org>
Powered by blists - more mailing lists