All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Pavel Emelyanov <xemul@openvz.org>
Cc: David Miller <davem@davemloft.net>,
	Linux Netdev List <netdev@vger.kernel.org>,
	devel@openvz.org
Subject: Re: [PATCH][NET-2.6.24] Remove double dev->flags checking when calling dev_close()
Date: Tue, 09 Oct 2007 07:33:14 -0400	[thread overview]
Message-ID: <470B66FA.80006@garzik.org> (raw)
In-Reply-To: <470B5D0E.9090202@openvz.org>

Pavel Emelyanov wrote:
> The unregister_netdevice() and dev_change_net_namespace() 
> both check for dev->flags to be IFF_UP before calling the 
> dev_close(), but the dev_close() checks for IFF_UP itself, 
> so remove those unneeded checks.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> 
> ---
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index e7e728a..1e169a5 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3893,8 +3893,7 @@ void unregister_netdevice(struct net_dev
>  	BUG_ON(dev->reg_state != NETREG_REGISTERED);
>  
>  	/* If device is running, close it first. */
> -	if (dev->flags & IFF_UP)
> -		dev_close(dev);
> +	dev_close(dev);
>  
>  	/* And unlink it from device chain. */
>  	unlist_netdevice(dev);
> @@ -4018,8 +4017,7 @@ int dev_change_net_namespace(struct net_
>  	 */
>  
>  	/* If device is running close it first. */
> -	if (dev->flags & IFF_UP)
> -		dev_close(dev);
> +	dev_close(dev);
>  
>  	/* And unlink it from device chain */
>  	err = -ENODEV;

One side effect of this patch:  might_sleep() is now called unconditionally.

If that is irrelevant... ACK.



  reply	other threads:[~2007-10-09 11:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-09 10:50 [PATCH][NET-2.6.24] Remove double dev->flags checking when calling dev_close() Pavel Emelyanov
2007-10-09 11:33 ` Jeff Garzik [this message]
2007-10-09 11:44   ` Pavel Emelyanov
2007-10-10  1:33   ` Herbert Xu
2007-10-10  9:49 ` 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=470B66FA.80006@garzik.org \
    --to=jeff@garzik.org \
    --cc=davem@davemloft.net \
    --cc=devel@openvz.org \
    --cc=netdev@vger.kernel.org \
    --cc=xemul@openvz.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.