netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Veaceslav Falico <vfalico@redhat.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: netdev@vger.kernel.org, nikolay@redhat.com,
	bhutchings@solarflare.com, Jay Vosburgh <fubar@us.ibm.com>,
	Andy Gospodarek <andy@greyhouse.net>
Subject: Re: [PATCH net-next 2/9] bonding: remove __get_first_port()
Date: Fri, 27 Sep 2013 17:05:17 +0200	[thread overview]
Message-ID: <20130927150517.GA833@redhat.com> (raw)
In-Reply-To: <20130927145825.GA14139@redhat.com>

On Fri, Sep 27, 2013 at 04:58:25PM +0200, Veaceslav Falico wrote:
>On Fri, Sep 27, 2013 at 03:50:12PM +0100, David Laight wrote:
>>>@@ -2104,8 +2091,11 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
>>>
>>> 	// check if agg_select_timer timer after initialize is timed out
>>> 	if (BOND_AD_INFO(bond).agg_select_timer && !(--BOND_AD_INFO(bond).agg_select_timer)) {
>>>+		slave = bond_first_slave(bond);
>>>+		port = slave ? &(SLAVE_AD_INFO(slave).port) : NULL;
>>>+
>>> 		// select the active aggregator for the bond
>>>-		if ((port = __get_first_port(bond))) {
>>>+		if (port) {
>>> 			if (!port->slave) {
>>> 				pr_warning("%s: Warning: bond's first port is uninitialized\n",
>>> 					   bond->dev->name);
>>>--
>>
>>Looks like that could be:
>>		slave = bond_first_slave(bond);
>>		if (slave) {
>>			port = SLAVE_AD_INFO(slave).port;
>>and I assume 'slave == port->slave' so there is no need for the latter check?
>
>I've also fallen to this trap at first - slave->port can (virtually) be
>NULL, and this way we'll panic on "if (!port->slave)".

Err, forgot to address the 'slave == port->slave' - yes, virtually it
should be - if it's initialized (and, it should be) - however, as I've
stated in the cover letter - there are *tons* of cleanups/optimizations of
these kind that might be done here - and not to mix cleanups/optimizations
with the thing that these patches should do (remove bond_next_slave) - I've
decided to leave it as close to the original as possible.

>
>>
>>	David
>>
>>
>>

  reply	other threads:[~2013-09-27 15:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 14:11 [PATCH net-next 0/9] bonding: remove bond_next_slave() Veaceslav Falico
2013-09-27 14:11 ` [PATCH net-next 1/9] bonding: remove __get_next_port() Veaceslav Falico
2013-09-27 14:11 ` [PATCH net-next 2/9] bonding: remove __get_first_port() Veaceslav Falico
2013-09-27 14:50   ` David Laight
2013-09-27 14:58     ` Veaceslav Falico
2013-09-27 15:05       ` Veaceslav Falico [this message]
2013-09-27 14:11 ` [PATCH net-next 3/9] bonding: make ad_port_selection_logic() use bond_for_each_slave() Veaceslav Falico
2013-09-27 14:12 ` [PATCH net-next 4/9] bonding: make __get_active_agg() " Veaceslav Falico
2013-09-27 14:12 ` [PATCH net-next 5/9] bonding: make ad_agg_selection_logic() " Veaceslav Falico
2013-09-27 14:12 ` [PATCH net-next 6/9] bonding: make bond_3ad_unbind_slave() " Veaceslav Falico
2013-09-27 14:12 ` [PATCH net-next 7/9] bonding: remove unused __get_next_agg() Veaceslav Falico
2013-09-27 14:12 ` [PATCH net-next 8/9] bonding: don't use bond_next_slave() in bond_info_seq_next() Veaceslav Falico
2013-09-27 14:12 ` [PATCH net-next 9/9] bonding: remove bond_next_slave() Veaceslav Falico
2013-09-28 22:29 ` [PATCH net-next 0/9] " David Miller

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=20130927150517.GA833@redhat.com \
    --to=vfalico@redhat.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=andy@greyhouse.net \
    --cc=bhutchings@solarflare.com \
    --cc=fubar@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@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 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).