All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
	David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 3/4] sky2: Hold RTNL while calling dev_close()
Date: Tue, 6 May 2008 16:17:20 -0700	[thread overview]
Message-ID: <20080506161720.6475e5d4@extreme> (raw)
In-Reply-To: <20080506183958.GI2217@solarflare.com>

On Tue, 6 May 2008 19:39:58 +0100
Ben Hutchings <bhutchings@solarflare.com> wrote:

> dev_close() must be called holding the RTNL.  Compile-tested only.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
>  drivers/net/sky2.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
> index f226bca..9b046dd 100644
> --- a/drivers/net/sky2.c
> +++ b/drivers/net/sky2.c
> @@ -2952,7 +2952,9 @@ static void sky2_restart(struct work_struct *work)
>  			if (err) {
>  				printk(KERN_INFO PFX "%s: could not restart %d\n",
>  				       dev->name, err);
> +				rtnl_lock();
>  				dev_close(dev);
> +				rtnl_unlock();
>  			}
>  		}
>  	}
> 

No this is bogus.  The rtnl mutex is already held.
Look a little wider

static void sky2_restart(struct work_struct *work)
{
	struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
	struct net_device *dev;
	int i, err;

	rtnl_lock();
	for (i = 0; i < hw->ports; i++) {
		dev = hw->dev[i];
		if (netif_running(dev))
			sky2_down(dev);
	}

	napi_disable(&hw->napi);
	sky2_write32(hw, B0_IMSK, 0);
	sky2_reset(hw);
	sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
	napi_enable(&hw->napi);

	for (i = 0; i < hw->ports; i++) {
		dev = hw->dev[i];
		if (netif_running(dev)) {
			err = sky2_up(dev);
			if (err) {
				printk(KERN_INFO PFX "%s: could not restart %d\n",
				       dev->name, err);
				dev_close(dev);
			}
		}
	}

	rtnl_unlock();
}

  parent reply	other threads:[~2008-05-06 23:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-06 18:26 [PATCH 0/4] dev_open() and dev_close() require RTNL Ben Hutchings
2008-05-06 18:34 ` [PATCH 1/4] Added ASSERT_RTNL() to dev_open() and dev_close() Ben Hutchings
2008-05-08  9:53   ` David Miller
2008-05-06 18:36 ` [PATCH 2/4] qla3xxx: Hold RTNL while calling dev_close() Ben Hutchings
2008-05-08  9:53   ` David Miller
2008-06-27  5:32   ` Jeff Garzik
2008-05-06 18:39 ` [PATCH 3/4] sky2: " Ben Hutchings
2008-05-06 20:26   ` Stephen Hemminger
2008-05-06 23:17   ` Stephen Hemminger [this message]
2008-05-06 23:59     ` Ben Hutchings
2008-05-31 15:52       ` [PATCH] sky2: Hold RTNL while calling dev_close() [2nd try] Ben Hutchings
2008-06-10 22:16         ` Jeff Garzik
2008-06-10 22:25           ` Stephen Hemminger
2008-06-10 22:40         ` Jeff Garzik
2008-05-06 18:41 ` [PATCH 4/4] Hold RTNL while calling dev_close() Ben Hutchings
2008-05-08  9:54   ` David Miller
2008-05-31 16:01     ` Ben Hutchings
2008-06-27  5:32   ` Jeff Garzik

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=20080506161720.6475e5d4@extreme \
    --to=shemminger@linux-foundation.org \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=jgarzik@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.