netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Jay Vosburgh <fubar@us.ibm.com>
Cc: netdev@oss.sgi.com
Subject: Re: PATCH: bonding might sleep with lock held
Date: Thu, 13 May 2004 10:20:53 +0200	[thread overview]
Message-ID: <20040513082053.GC27682@wotan.suse.de> (raw)
In-Reply-To: <200405130215.i4D2FX52016740@death.nxdomain.ibm.com>

On Wed, May 12, 2004 at 07:15:33PM -0700, Jay Vosburgh wrote:
> 
> 	In 802.3ad mode, the bond_close() function will eventually call
> dev_remove_pack() with a lock held.  In turn, dev_remove_pack() calls
> synchronize_net() which eventually might sleep in wait_for_completion().
> Probably not good.
> 
> 	This patch replaces dev_remove_pack() with __dev_remove_pack()
> and adds a synchronize_net() call outside the lock.  The patch is
> against 2.6.5, but applied to 2.6.6 for me.

I would rather fix bond_close to not call this with the lock hold.
You can just move the call a few lines up. dev->close has own
synchronization anyways and dev_remove_pack has a lock too, so this
should be safe.

Patch to do that appeneded.

-Andi


diff -u linux/drivers/net/bonding/bond_main.c-o linux/drivers/net/bonding/bond_main.c
--- linux/drivers/net/bonding/bond_main.c-o	1970-01-01 01:12:51.000000000 +0100
+++ linux/drivers/net/bonding/bond_main.c	2004-05-13 10:20:06.000000000 +0200
@@ -3566,15 +3566,15 @@
 {
 	struct bonding *bond = bond_dev->priv;
 
-	write_lock_bh(&bond->lock);
-
-	bond_mc_list_destroy(bond);
-
 	if (bond->params.mode == BOND_MODE_8023AD) {
 		/* Unregister the receive of LACPDUs */
 		bond_unregister_lacpdu(bond);
 	}
 
+	write_lock_bh(&bond->lock);
+
+	bond_mc_list_destroy(bond);
+
 	/* signal timers not to re-arm */
 	bond->kill_timers = 1;
 

  reply	other threads:[~2004-05-13  8:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-13  2:15 PATCH: bonding might sleep with lock held Jay Vosburgh
2004-05-13  8:20 ` Andi Kleen [this message]
2004-05-13 18:44   ` Jay Vosburgh
2004-05-13 19:04     ` Andi Kleen
2004-05-13 19:34       ` Jay Vosburgh

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=20040513082053.GC27682@wotan.suse.de \
    --to=ak@suse.de \
    --cc=fubar@us.ibm.com \
    --cc=netdev@oss.sgi.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).