All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, Jay Vosburgh <j.vosburgh@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Jonathan Toppins <jtoppins@redhat.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>, liali <liali@redhat.com>
Subject: Re: [PATCH net 2/3] bonding: do failover when high prio link up
Date: Fri, 9 Dec 2022 16:03:35 -0800	[thread overview]
Message-ID: <Y5PM1z1SEdWFgkui@x130> (raw)
In-Reply-To: <20221209101305.713073-3-liuhangbin@gmail.com>

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@redhat.com>
>Fixes: 0a2ff7cc8ad4 ("Bonding: add per-port priority for failover re-selection")
>Signed-off-by: Hangbin Liu <liuhangbin@gmail.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@kernel.org>








  reply	other threads:[~2022-12-10  0:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 10:13 [PATCH net 0/3] Bonding: fix high prio not effect issue Hangbin Liu
2022-12-09 10:13 ` [PATCH net 1/3] bonding: access curr_active_slave with rtnl_dereference Hangbin Liu
2022-12-09 23:46   ` Saeed Mahameed
2022-12-09 23:58   ` Eric Dumazet
2022-12-10 12:28     ` Hangbin Liu
2022-12-10 17:41       ` Eric Dumazet
2022-12-12  1:57         ` Hangbin Liu
2022-12-09 10:13 ` [PATCH net 2/3] bonding: do failover when high prio link up Hangbin Liu
2022-12-10  0:03   ` Saeed Mahameed [this message]
2022-12-10 12:23     ` Hangbin Liu
2022-12-09 10:13 ` [PATCH net 3/3] selftests: bonding: add bonding prio option test Hangbin Liu
2022-12-10  0:01 ` [PATCH net 0/3] Bonding: fix high prio not effect issue Jay Vosburgh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y5PM1z1SEdWFgkui@x130 \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=j.vosburgh@gmail.com \
    --cc=jtoppins@redhat.com \
    --cc=kuba@kernel.org \
    --cc=liali@redhat.com \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.