From: Mazhar Rana <ranamazharp@gmail.com>
To: netdev@vger.kernel.org, j.vosburgh@gmail.com, vfalico@gmail.com,
gospo@cumulusnetworks.com
Cc: Mazhar Rana <ranamazharp@gmail.com>,
davem@davemloft.net, sanket.shah@cyberoam.com,
mazhar.rana@cyberoam.com, linux-kernel@vger.kernel.org
Subject: [PATCH v2] bonding: "primary_reselect" with "failure" is not working properly
Date: Thu, 2 Jul 2015 17:37:19 +0530 [thread overview]
Message-ID: <1435838839-21233-1-git-send-email-ranamazharp@gmail.com> (raw)
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 <mazhar.rana@cyberoam.com>
Reviewed-by: Sanket Shah <sanket.shah@cyberoam.com>
---
v2: return "curr" instead of "bond->curr_active_slave".
drivers/net/bonding/bond_main.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 19eb990..ac71261 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -715,7 +715,7 @@ static bool bond_should_change_active(struct bonding *bond)
*/
static struct slave *bond_find_best_slave(struct bonding *bond)
{
- struct slave *slave, *bestslave = NULL, *primary;
+ struct slave *slave, *bestslave = NULL, *primary, *curr;
struct list_head *iter;
int mintime = bond->params.updelay;
@@ -724,6 +724,14 @@ static struct slave *bond_find_best_slave(struct bonding *bond)
bond_should_change_active(bond))
return primary;
+ /* We are here means primary interface is not candidate for
+ * reslection/failover. If currenet active slave is still up
+ * then there is no meaning to traverse members.
+ */
+ curr = rtnl_dereference(bond->curr_active_slave);
+ if (curr && curr->link == BOND_LINK_UP)
+ return curr;
+
bond_for_each_slave(bond, slave, iter) {
if (slave->link == BOND_LINK_UP)
return slave;
--
1.9.1
next reply other threads:[~2015-07-02 12:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 12:07 Mazhar Rana [this message]
2015-07-02 20:42 ` [PATCH v2] bonding: "primary_reselect" with "failure" is not working properly Jay Vosburgh
2015-07-03 9:53 ` GMAIL
2015-07-03 18:16 ` Jay Vosburgh
2015-07-06 12:04 ` GMAIL
2015-07-06 15:32 ` Andy Gospodarek
2015-07-07 9:07 ` GMAIL
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=1435838839-21233-1-git-send-email-ranamazharp@gmail.com \
--to=ranamazharp@gmail.com \
--cc=davem@davemloft.net \
--cc=gospo@cumulusnetworks.com \
--cc=j.vosburgh@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mazhar.rana@cyberoam.com \
--cc=netdev@vger.kernel.org \
--cc=sanket.shah@cyberoam.com \
--cc=vfalico@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).