From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Garzik 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 Message-ID: <470B66FA.80006@garzik.org> References: <470B5D0E.9090202@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: David Miller , Linux Netdev List , devel@openvz.org To: Pavel Emelyanov Return-path: Received: from srv5.dvmed.net ([207.36.208.214]:46813 "EHLO mail.dvmed.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbXJILdZ (ORCPT ); Tue, 9 Oct 2007 07:33:25 -0400 In-Reply-To: <470B5D0E.9090202@openvz.org> Sender: netdev-owner@vger.kernel.org List-Id: netdev.vger.kernel.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 > > --- > > 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.