When "primary_reselect" is set to "failure", primary interface should
not become active until current active slave is up. But if we set first
member of bond device as a "primary" interface and "primary_reselect"
is set to "failure" then whenever primary interface's link get back(up)
it become active slave even if current active slave is still up.
With this patch, "bond_find_best_slave" will not traverse members if
primary interface is not candidate for failover/reselection and current
active slave is still up.
Signed-off-by: Mazhar Rana <redacted>
Reviewed-by: Sanket Shah <redacted>
---
drivers/net/bonding/bond_main.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
@@ -724,6 +724,14 @@ static struct slave *bond_find_best_slave(struct bonding *bond)bond_should_change_active(bond))returnprimary;+/* We are here means primary interface is not candidate for+*reslection/failover.Ifcurrenetactiveslaveisstillup+*thenthereisnomeaningtotraversemembers.+*/+curr=rtnl_dereference(bond->curr_active_slave);+if(curr&&curr->link==BOND_LINK_UP)+returnbond->curr_active_slave;+bond_for_each_slave(bond,slave,iter){if(slave->link==BOND_LINK_UP)returnslave;
From: Eric Dumazet <hidden> Date: 2015-07-02 11:35:56
On Thu, 2015-07-02 at 15:43 +0530, Mazhar Rana wrote:
quoted hunk
When "primary_reselect" is set to "failure", primary interface should
not become active until current active slave is up. But if we set first
member of bond device as a "primary" interface and "primary_reselect"
is set to "failure" then whenever primary interface's link get back(up)
it become active slave even if current active slave is still up.
With this patch, "bond_find_best_slave" will not traverse members if
primary interface is not candidate for failover/reselection and current
active slave is still up.
Signed-off-by: Mazhar Rana <redacted>
Reviewed-by: Sanket Shah <redacted>
---
drivers/net/bonding/bond_main.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
@@ -724,6 +724,14 @@ static struct slave *bond_find_best_slave(struct bonding *bond)bond_should_change_active(bond))returnprimary;+/* We are here means primary interface is not candidate for+*reslection/failover.Ifcurrenetactiveslaveisstillup+*thenthereisnomeaningtotraversemembers.+*/+curr=rtnl_dereference(bond->curr_active_slave);
Here you carefully use rtnl_dereference(bond->curr_active_slave)
(This is good)
+ if (curr && curr->link == BOND_LINK_UP)
+ return bond->curr_active_slave;
But here you return bond->curr_active_slave
instead of curr