public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jay Vosburgh <fubar@us.ibm.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: Re: [PATCH net-2.6 2/3] bonding: Change active slave quietly when bond is down
Date: Mon, 13 Dec 2010 12:41:44 -0800	[thread overview]
Message-ID: <32030.1292272904@death> (raw)
In-Reply-To: <1292264396.9860.14.camel@bwh-desktop>

Ben Hutchings <bhutchings@solarflare.com> wrote:

>bond_change_active_slave() may be called when a slave is added, even
>if the bond has not been brought up yet.  It may then attempt to send
>packets, and further it may use mcast_work which is uninitialised
>before the bond is brought up.  Add the necessary checks for
>netif_running(bond->dev).

	I wondered if it would be better to instead arrange for
bond_change_active_slave (and bond_select_active_slave, which calls it)
to not be called when the bond is down, but that would require quite a
bit of change to bond_enslave and bond_open.

	-J

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>


>Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
>---
> drivers/net/bonding/bond_main.c |   15 +++++++++------
> 1 files changed, 9 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index ef370c9..3b16c34 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -1178,11 +1178,13 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
> 				bond_do_fail_over_mac(bond, new_active,
> 						      old_active);
>
>-			bond->send_grat_arp = bond->params.num_grat_arp;
>-			bond_send_gratuitous_arp(bond);
>+			if (netif_running(bond->dev)) {
>+				bond->send_grat_arp = bond->params.num_grat_arp;
>+				bond_send_gratuitous_arp(bond);
>
>-			bond->send_unsol_na = bond->params.num_unsol_na;
>-			bond_send_unsolicited_na(bond);
>+				bond->send_unsol_na = bond->params.num_unsol_na;
>+				bond_send_unsolicited_na(bond);
>+			}
>
> 			write_unlock_bh(&bond->curr_slave_lock);
> 			read_unlock(&bond->lock);
>@@ -1196,8 +1198,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
>
> 	/* resend IGMP joins since active slave has changed or
> 	 * all were sent on curr_active_slave */
>-	if ((USES_PRIMARY(bond->params.mode) && new_active) ||
>-	    bond->params.mode == BOND_MODE_ROUNDROBIN) {
>+	if (((USES_PRIMARY(bond->params.mode) && new_active) ||
>+	     bond->params.mode == BOND_MODE_ROUNDROBIN) &&
>+	    netif_running(bond->dev)) {
> 		bond->igmp_retrans = bond->params.resend_igmp;
> 		queue_delayed_work(bond->wq, &bond->mcast_work, 0);
> 	}
>-- 
>1.7.3.2
>
>
>
>-- 
>Ben Hutchings, Senior Software Engineer, Solarflare Communications
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-12-13 20:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-13 18:16 [PATCH net-next-2.6 0/3] bonding fixes Ben Hutchings
2010-12-13 18:18 ` Ben Hutchings
2010-12-16 20:42   ` David Miller
2010-12-13 18:19 ` [PATCH net-2.6 1/3] bonding/vlan: Remove redundant VLAN tag insertion logic Ben Hutchings
2010-12-13 19:58   ` Jay Vosburgh
2010-12-13 22:08     ` Jesse Gross
2010-12-13 18:19 ` [PATCH net-2.6 2/3] bonding: Change active slave quietly when bond is down Ben Hutchings
2010-12-13 20:41   ` Jay Vosburgh [this message]
2010-12-13 21:06     ` Ben Hutchings
2010-12-21  2:46   ` Flavio Leitner
2010-12-13 18:20 ` [PATCH net-2.6 3/3] bonding/vlan: Fix mangled NAs on slaves without VLAN tag insertion Ben Hutchings
2010-12-13 20:43   ` Jay Vosburgh
2010-12-13 22:20   ` Jesse Gross

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=32030.1292272904@death \
    --to=fubar@us.ibm.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.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