From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Lezcano Subject: Re: [net-2.6 patch 1/2][NETNS] fix device renaming for sysfs Date: Wed, 04 Jun 2008 15:50:13 +0200 Message-ID: <48469D95.3050703@fr.ibm.com> References: <20080430213113.410541118@localhost.localdomain> <20080430213320.825349005@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: davem@davemloft.net, netdev@vger.kernel.org To: "Eric W. Biederman" Return-path: Received: from mtagate2.de.ibm.com ([195.212.29.151]:17749 "EHLO mtagate2.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752547AbYFDNuX (ORCPT ); Wed, 4 Jun 2008 09:50:23 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.8/8.13.8) with ESMTP id m54DoG2o180116 for ; Wed, 4 Jun 2008 13:50:16 GMT Received: from d12av04.megacenter.de.ibm.com (d12av04.megacenter.de.ibm.com [9.149.165.229]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m54DoFax3751968 for ; Wed, 4 Jun 2008 15:50:15 +0200 Received: from d12av04.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av04.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m54DoFqe007185 for ; Wed, 4 Jun 2008 15:50:15 +0200 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: Eric W. Biederman wrote: > Daniel Lezcano writes: > >> When a netdev is moved across namespaces with the 'dev_change_net_namespace' >> function, the 'device_rename' function is used to fixup kobject and refresh >> the sysfs tree. The device_rename function will call kobject_rename and this >> one will check if there is an object with the same name and this is the case >> because we are renaming the object with the same name. >> >> The use of 'device_rename' seems for me wrong because we usually don't >> rename it but just move it across namespaces. As we just want to do a >> mini "netdev_[un]register", IMO the functions 'netdev_[un]register_kobject' >> should be used instead, like an usual network device [un]registering. > > device_rename is correct. Because doing device_del; device_add removes > any driver specific sysfs attributes. > > Causing your patch to introduce subtle driver breakage only when we > move a network device between namespaces. Ouch! > > To support this operation we need something like device_rename that > can preserve driver specific attributes, and generally handle > movement between namespaces. Since device_rename already does 99% of > what we need it to do I found it easier to extend device_rename to > handle this case then to introduce yet another function into the > kobject layer. > >> This patch replace device_rename by netdev_unregister_kobject, followed by >> netdev_register_kobject. > > And sysfs comes a' tumblin' down. > My apologies for not replying sooner I just spotted this. My fault, I should have Cc'ed you when sending the email :( Thanks for looking at this patch. -- Daniel