From: Veaceslav Falico <vfalico@redhat.com>
To: Jay Vosburgh <fubar@us.ibm.com>
Cc: netdev@vger.kernel.org, Ding Tianhong <dingtianhong@huawei.com>,
Andy Gospodarek <andy@greyhouse.net>
Subject: Re: [PATCH v2 net-next] bonding: handle slave's name change with primary_slave logic
Date: Tue, 14 Jan 2014 18:33:01 +0100 [thread overview]
Message-ID: <20140114173301.GC1867@redhat.com> (raw)
In-Reply-To: <4299.1389720779@death.nxdomain>
On Tue, Jan 14, 2014 at 09:32:59AM -0800, Jay Vosburgh wrote:
>Veaceslav Falico <vfalico@redhat.com> wrote:
>
>>Currently, if a slave's name change, we just pass it by. However, if the
>>slave is a current primary_slave, then we end up with using a slave, whose
>>name != params.primary, for primary_slave. And vice-versa, if we don't have
>>a primary_slave but have params.primary set - we will not detected a new
>>primary_slave.
>>
>>Fix this by catching the NETDEV_CHANGENAME event and setting primary_slave
>>accordingly. Also, if the primary_slave was changed, issue a reselection of
>>the active slave, cause the priorities have changed.
>>
>>Reported-by: Ding Tianhong <dingtianhong@huawei.com>
>>CC: Ding Tianhong <dingtianhong@huawei.com>
>>CC: Jay Vosburgh <fubar@us.ibm.com>
>>CC: Andy Gospodarek <andy@greyhouse.net>
>>Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
>>---
>> drivers/net/bonding/bond_main.c | 23 ++++++++++++++++++++---
>> 1 file changed, 20 insertions(+), 3 deletions(-)
>>
>>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>>index e06c445..8077199 100644
>>--- a/drivers/net/bonding/bond_main.c
>>+++ b/drivers/net/bonding/bond_main.c
>>@@ -2860,9 +2860,26 @@ static int bond_slave_netdev_event(unsigned long event,
>> */
>> break;
>> case NETDEV_CHANGENAME:
>>- /*
>>- * TODO: handle changing the primary's name
>>- */
>>+ /* we don't care if we don't have primary set */
>>+ if (!USES_PRIMARY(bond->params.mode) ||
>>+ !bond->params.primary[0])
>>+ break;
>>+
>>+ if (slave == bond->primary_slave) {
>>+ /* slave's name changed - he's no longer primary */
>>+ bond->primary_slave = NULL;
>>+ } else if (!strcmp(slave_dev->name, bond->params.primary)) {
>>+ /* we have a new primary slave */
>>+ bond->primary_slave = slave;
>>+ } else /* we didn't change primary - exit */
>>+ break;
>>+
>>+ pr_info("%s: Primary slave changed to %s, re-electing.\n",
>
> I suspect you mean "reselecting" here, not "re-electing." I'd
>add a couple more words, e.g., "reselecting active slave" to make it
>clearer.
Yep, sure, will reword and send v3.
Thank you!
>
> -J
>
>>+ bond->dev->name, bond->primary_slave ? slave_dev->name :
>>+ "none");
>>+ write_lock_bh(&bond->curr_slave_lock);
>>+ bond_select_active_slave(bond);
>>+ write_unlock_bh(&bond->curr_slave_lock);
>> break;
>> case NETDEV_FEAT_CHANGE:
>> bond_compute_features(bond);
>>--
>>1.8.4
>>
>
>---
> -Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
>
prev parent reply other threads:[~2014-01-14 17:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 11:49 [PATCH v2 net-next] bonding: handle slave's name change with primary_slave logic Veaceslav Falico
2014-01-14 17:32 ` Jay Vosburgh
2014-01-14 17:33 ` Veaceslav Falico [this message]
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=20140114173301.GC1867@redhat.com \
--to=vfalico@redhat.com \
--cc=andy@greyhouse.net \
--cc=dingtianhong@huawei.com \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
/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).