* [PATCH][NET-2.6.24] Remove double dev->flags checking when calling dev_close()
@ 2007-10-09 10:50 Pavel Emelyanov
2007-10-09 11:33 ` Jeff Garzik
2007-10-10 9:49 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Pavel Emelyanov @ 2007-10-09 10:50 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, devel
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;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH][NET-2.6.24] Remove double dev->flags checking when calling dev_close()
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
2007-10-09 11:44 ` Pavel Emelyanov
2007-10-10 1:33 ` Herbert Xu
2007-10-10 9:49 ` David Miller
1 sibling, 2 replies; 5+ messages in thread
From: Jeff Garzik @ 2007-10-09 11:33 UTC (permalink / raw)
To: Pavel Emelyanov; +Cc: David Miller, Linux Netdev List, devel
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][NET-2.6.24] Remove double dev->flags checking when calling dev_close()
2007-10-09 11:33 ` Jeff Garzik
@ 2007-10-09 11:44 ` Pavel Emelyanov
2007-10-10 1:33 ` Herbert Xu
1 sibling, 0 replies; 5+ messages in thread
From: Pavel Emelyanov @ 2007-10-09 11:44 UTC (permalink / raw)
To: Jeff Garzik; +Cc: David Miller, Linux Netdev List, devel
Jeff Garzik wrote:
> 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.
That's not a big deal - see, the synchronize_net() is called further
in both places unconditionally (!) and also calls might_sleep(), so
this is OK.
> If that is irrelevant... ACK.
Thanks :)
>
> -
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][NET-2.6.24] Remove double dev->flags checking when calling dev_close()
2007-10-09 11:33 ` Jeff Garzik
2007-10-09 11:44 ` Pavel Emelyanov
@ 2007-10-10 1:33 ` Herbert Xu
1 sibling, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2007-10-10 1:33 UTC (permalink / raw)
To: Jeff Garzik; +Cc: xemul, davem, netdev, devel
Jeff Garzik <jeff@garzik.org> wrote:
>
> One side effect of this patch: might_sleep() is now called unconditionally.
That would be seem to be a good thing :)
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][NET-2.6.24] Remove double dev->flags checking when calling dev_close()
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
@ 2007-10-10 9:49 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2007-10-10 9:49 UTC (permalink / raw)
To: xemul; +Cc: netdev, devel
From: Pavel Emelyanov <xemul@openvz.org>
Date: Tue, 09 Oct 2007 14:50:54 +0400
> 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>
Applied, thanks Pavel.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-10-10 9:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-10-09 11:44 ` Pavel Emelyanov
2007-10-10 1:33 ` Herbert Xu
2007-10-10 9:49 ` David Miller
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).