Re: [PATCH] Module use count must be updated as bridges are created/destroyed
On Fri, Sep 28, 2007 at 11:11:07AM -0700, Stephen Hemminger wrote: > > It is only the nested removal problem. Well such a count could apply to direct removals too. In other words, you could ask modprobe to remove all modules for which this count is zero. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
On Fri, 28 Sep 2007 13:37:39 +0800 Herbert Xu <[EMAIL PROTECTED]> wrote: > Jan Beulich <[EMAIL PROTECTED]> wrote: > > > > So we have an unsolvable problem here then, unless infrastructure gets added > > that allows a module to declare itself as not-implicit-unload-safe, forcing > > modprobe -r to keep its hands off it. Ugly. > > Yes I've always wanted to have a separate count that indicates > a module is in use but does not prevent its immediate removal. > > Cheers, It is only the nested removal problem. -- Stephen Hemminger <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
On Fri, 28 Sep 2007 13:37:39 +0800 Herbert Xu [EMAIL PROTECTED] wrote: Jan Beulich [EMAIL PROTECTED] wrote: So we have an unsolvable problem here then, unless infrastructure gets added that allows a module to declare itself as not-implicit-unload-safe, forcing modprobe -r to keep its hands off it. Ugly. Yes I've always wanted to have a separate count that indicates a module is in use but does not prevent its immediate removal. Cheers, It is only the nested removal problem. -- Stephen Hemminger [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
On Fri, Sep 28, 2007 at 11:11:07AM -0700, Stephen Hemminger wrote: It is only the nested removal problem. Well such a count could apply to direct removals too. In other words, you could ask modprobe to remove all modules for which this count is zero. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
Jan Beulich <[EMAIL PROTECTED]> wrote: > > So we have an unsolvable problem here then, unless infrastructure gets added > that allows a module to declare itself as not-implicit-unload-safe, forcing > modprobe -r to keep its hands off it. Ugly. Yes I've always wanted to have a separate count that indicates a module is in use but does not prevent its immediate removal. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
>> >Sounds like a module utilities problem since unloading one module doesn't >> >normally unload others. >> >> I have to disagree here - 'modprobe -r' is specifically unloading all >> modules the >> specified one references as long as they have a use count of zero. The >> difference to other networking modules is that the latter normally don't >> export >> symbols, and hence don't have dependent modules (and thus cannot be >> subject of implicit unloading). Bridge does have dependents, and hence must >> avoid implicit unloading by managing its use count. > >I want keep the behavior that: > modprobe -r bridge >removes all bridges. It is too useful and may already be in some user scripts. So we have an unsolvable problem here then, unless infrastructure gets added that allows a module to declare itself as not-implicit-unload-safe, forcing modprobe -r to keep its hands off it. Ugly. Jan - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Sep 27 2007 07:51, Stephen Hemminger wrote: > >You need every socket to close and all routes to go away including the >routes through loopback device, and still there probably are control >sockets buried inside ipv6 that hold ref count. > >IMHO the kernel should just admit that IPV6 can't be removed. I cannot accept that. If ipv6.ko has a way to tack ipv6 structs onto all sockets, interfaces and addresses, it should also be able to untack it again. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Thu, 27 Sep 2007 13:54:23 +0200 Helge Hafting <[EMAIL PROTECTED]> wrote: > Stephen Hemminger wrote: > > On Thu, 27 Sep 2007 00:18:55 +0200 (CEST) > > Jan Engelhardt <[EMAIL PROTECTED]> wrote: > > > > > >> On Sep 26 2007 14:06, Stephen Hemminger wrote: > >> > > No, network devices don't do reference counting. > > > Could you explain why, please? > > After `udevd` on boot loads lots of unused crap, i surrendered, and use > $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, > there are lots of configs: udev, hotplug, modprobe, that somebody might > like to fix. But it came to the end with me. I just don't care. So, > please answer :) > > >>> For hotplug and other reasons, the network developers decided that being > >>> able to remove a network module at any time was a good thing. It works. > >>> > >> Except that for ipv6.ko, it's all opposite. After modprobe, > >> it already got a refcount like 8 and you're wondering how > >> to get rid of that. > >> > > > > ipv6 is not a network driver, it is a protocol. You might be able to remove > > it if you zap > > all the routes and applications, ... > > > Wouldn't it be enough to down all the interfaces and close all the sockets? > No need to bring down every app. You need every socket to close and all routes to go away including the routes through loopback device, and still there probably are control sockets buried inside ipv6 that hold ref count. IMHO the kernel should just admit that IPV6 can't be removed. --- a/net/ipv6/af_inet6.c 2007-09-26 16:28:01.0 -0700 +++ b/net/ipv6/af_inet6.c 2007-09-26 17:38:23.0 -0700 @@ -914,6 +914,9 @@ out_unregister_tcp_proto: } module_init(inet6_init); +/* Disabled at present because it is impossible to remove all references */ +#ifdef IPV6_UNLOAD + static void __exit inet6_exit(void) { /* First of all disallow new sockets creation. */ @@ -952,5 +955,6 @@ static void __exit inet6_exit(void) proto_unregister(_prot); } module_exit(inet6_exit); +#endif MODULE_ALIAS_NETPROTO(PF_INET6); --- a/net/ipv6/addrconf.c 2007-09-26 15:07:35.0 -0700 +++ b/net/ipv6/addrconf.c 2007-09-26 17:36:52.0 -0700 @@ -4255,6 +4255,7 @@ errout: return err; } +#ifdef IPV6_UNLOAD void __exit addrconf_cleanup(void) { struct net_device *dev; @@ -4308,3 +4309,4 @@ void __exit addrconf_cleanup(void) proc_net_remove(_net, "if_inet6"); #endif } +#endif --- a/net/ipv6/ipv6_sockglue.c 2007-09-26 15:07:35.0 -0700 +++ b/net/ipv6/ipv6_sockglue.c 2007-09-26 17:36:17.0 -0700 @@ -1132,7 +1132,9 @@ void __init ipv6_packet_init(void) dev_add_pack(_packet_type); } -void ipv6_packet_cleanup(void) +#ifdef IPV6_UNLOAD +void __exit ipv6_packet_cleanup(void) { dev_remove_pack(_packet_type); } +#endif - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
On Thu, 27 Sep 2007 08:40:10 +0100 "Jan Beulich" <[EMAIL PROTECTED]> wrote: > >>> Stephen Hemminger <[EMAIL PROTECTED]> 26.09.07 19:12 >>> > >On Wed, 26 Sep 2007 17:08:19 +0100 > >"Jan Beulich" <[EMAIL PROTECTED]> wrote: > > > >> >>> Stephen Hemminger <[EMAIL PROTECTED]> 26.09.07 17:37 >>> > >> >On Wed, 26 Sep 2007 08:53:27 +0100 > >> >"Jan Beulich" <[EMAIL PROTECTED]> wrote: > >> > > >> >> Otherwise 'modprobe -r' on a module having a dependency on bridge will > >> >> implicitly unload bridge, bringing down all connectivity that was > >> >> using bridges. > >> >> > >> >> Signed-off-by: Jan Beulich <[EMAIL PROTECTED]> > >> >> > >> > > >> >No, network devices don't do reference counting. > >> >What is the dependency? Where is the source of the module interacting > >> >with the bridge? > >> > >> On a Xen system, I loaded and then unloaded ebtable_broute. The unload > >> implicitly unloaded bridge, destroying the network. The only way I could > >> see > >> to avoid the implicit unload was to bump the reference count on bridge > >> creation. Otherwise I would have to ask why bridge has a zero reference > >> count despite a bridge being configured. > >> > >> Jan > > > >Sounds like a module utilities problem since unloading one module doesn't > >normally unload others. > > I have to disagree here - 'modprobe -r' is specifically unloading all modules > the > specified one references as long as they have a use count of zero. The > difference to other networking modules is that the latter normally don't > export > symbols, and hence don't have dependent modules (and thus cannot be > subject of implicit unloading). Bridge does have dependents, and hence must > avoid implicit unloading by managing its use count. I want keep the behavior that: modprobe -r bridge removes all bridges. It is too useful and may already be in some user scripts. -- Stephen Hemminger <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
Stephen Hemminger wrote: On Thu, 27 Sep 2007 00:18:55 +0200 (CEST) Jan Engelhardt <[EMAIL PROTECTED]> wrote: On Sep 26 2007 14:06, Stephen Hemminger wrote: No, network devices don't do reference counting. Could you explain why, please? After `udevd` on boot loads lots of unused crap, i surrendered, and use $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, there are lots of configs: udev, hotplug, modprobe, that somebody might like to fix. But it came to the end with me. I just don't care. So, please answer :) For hotplug and other reasons, the network developers decided that being able to remove a network module at any time was a good thing. It works. Except that for ipv6.ko, it's all opposite. After modprobe, it already got a refcount like 8 and you're wondering how to get rid of that. ipv6 is not a network driver, it is a protocol. You might be able to remove it if you zap all the routes and applications, ... Wouldn't it be enough to down all the interfaces and close all the sockets? No need to bring down every app. Helge Hafting - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
>>> Stephen Hemminger <[EMAIL PROTECTED]> 26.09.07 19:12 >>> >On Wed, 26 Sep 2007 17:08:19 +0100 >"Jan Beulich" <[EMAIL PROTECTED]> wrote: > >> >>> Stephen Hemminger <[EMAIL PROTECTED]> 26.09.07 17:37 >>> >> >On Wed, 26 Sep 2007 08:53:27 +0100 >> >"Jan Beulich" <[EMAIL PROTECTED]> wrote: >> > >> >> Otherwise 'modprobe -r' on a module having a dependency on bridge will >> >> implicitly unload bridge, bringing down all connectivity that was >> >> using bridges. >> >> >> >> Signed-off-by: Jan Beulich <[EMAIL PROTECTED]> >> >> >> > >> >No, network devices don't do reference counting. >> >What is the dependency? Where is the source of the module interacting >> >with the bridge? >> >> On a Xen system, I loaded and then unloaded ebtable_broute. The unload >> implicitly unloaded bridge, destroying the network. The only way I could see >> to avoid the implicit unload was to bump the reference count on bridge >> creation. Otherwise I would have to ask why bridge has a zero reference >> count despite a bridge being configured. >> >> Jan > >Sounds like a module utilities problem since unloading one module doesn't >normally unload others. I have to disagree here - 'modprobe -r' is specifically unloading all modules the specified one references as long as they have a use count of zero. The difference to other networking modules is that the latter normally don't export symbols, and hence don't have dependent modules (and thus cannot be subject of implicit unloading). Bridge does have dependents, and hence must avoid implicit unloading by managing its use count. Jan - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
Stephen Hemminger [EMAIL PROTECTED] 26.09.07 19:12 On Wed, 26 Sep 2007 17:08:19 +0100 Jan Beulich [EMAIL PROTECTED] wrote: Stephen Hemminger [EMAIL PROTECTED] 26.09.07 17:37 On Wed, 26 Sep 2007 08:53:27 +0100 Jan Beulich [EMAIL PROTECTED] wrote: Otherwise 'modprobe -r' on a module having a dependency on bridge will implicitly unload bridge, bringing down all connectivity that was using bridges. Signed-off-by: Jan Beulich [EMAIL PROTECTED] No, network devices don't do reference counting. What is the dependency? Where is the source of the module interacting with the bridge? On a Xen system, I loaded and then unloaded ebtable_broute. The unload implicitly unloaded bridge, destroying the network. The only way I could see to avoid the implicit unload was to bump the reference count on bridge creation. Otherwise I would have to ask why bridge has a zero reference count despite a bridge being configured. Jan Sounds like a module utilities problem since unloading one module doesn't normally unload others. I have to disagree here - 'modprobe -r' is specifically unloading all modules the specified one references as long as they have a use count of zero. The difference to other networking modules is that the latter normally don't export symbols, and hence don't have dependent modules (and thus cannot be subject of implicit unloading). Bridge does have dependents, and hence must avoid implicit unloading by managing its use count. Jan - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
Stephen Hemminger wrote: On Thu, 27 Sep 2007 00:18:55 +0200 (CEST) Jan Engelhardt [EMAIL PROTECTED] wrote: On Sep 26 2007 14:06, Stephen Hemminger wrote: No, network devices don't do reference counting. Could you explain why, please? After `udevd` on boot loads lots of unused crap, i surrendered, and use $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, there are lots of configs: udev, hotplug, modprobe, that somebody might like to fix. But it came to the end with me. I just don't care. So, please answer :) For hotplug and other reasons, the network developers decided that being able to remove a network module at any time was a good thing. It works. Except that for ipv6.ko, it's all opposite. After modprobe, it already got a refcount like 8 and you're wondering how to get rid of that. ipv6 is not a network driver, it is a protocol. You might be able to remove it if you zap all the routes and applications, ... Wouldn't it be enough to down all the interfaces and close all the sockets? No need to bring down every app. Helge Hafting - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
On Thu, 27 Sep 2007 08:40:10 +0100 Jan Beulich [EMAIL PROTECTED] wrote: Stephen Hemminger [EMAIL PROTECTED] 26.09.07 19:12 On Wed, 26 Sep 2007 17:08:19 +0100 Jan Beulich [EMAIL PROTECTED] wrote: Stephen Hemminger [EMAIL PROTECTED] 26.09.07 17:37 On Wed, 26 Sep 2007 08:53:27 +0100 Jan Beulich [EMAIL PROTECTED] wrote: Otherwise 'modprobe -r' on a module having a dependency on bridge will implicitly unload bridge, bringing down all connectivity that was using bridges. Signed-off-by: Jan Beulich [EMAIL PROTECTED] No, network devices don't do reference counting. What is the dependency? Where is the source of the module interacting with the bridge? On a Xen system, I loaded and then unloaded ebtable_broute. The unload implicitly unloaded bridge, destroying the network. The only way I could see to avoid the implicit unload was to bump the reference count on bridge creation. Otherwise I would have to ask why bridge has a zero reference count despite a bridge being configured. Jan Sounds like a module utilities problem since unloading one module doesn't normally unload others. I have to disagree here - 'modprobe -r' is specifically unloading all modules the specified one references as long as they have a use count of zero. The difference to other networking modules is that the latter normally don't export symbols, and hence don't have dependent modules (and thus cannot be subject of implicit unloading). Bridge does have dependents, and hence must avoid implicit unloading by managing its use count. I want keep the behavior that: modprobe -r bridge removes all bridges. It is too useful and may already be in some user scripts. -- Stephen Hemminger [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Thu, 27 Sep 2007 13:54:23 +0200 Helge Hafting [EMAIL PROTECTED] wrote: Stephen Hemminger wrote: On Thu, 27 Sep 2007 00:18:55 +0200 (CEST) Jan Engelhardt [EMAIL PROTECTED] wrote: On Sep 26 2007 14:06, Stephen Hemminger wrote: No, network devices don't do reference counting. Could you explain why, please? After `udevd` on boot loads lots of unused crap, i surrendered, and use $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, there are lots of configs: udev, hotplug, modprobe, that somebody might like to fix. But it came to the end with me. I just don't care. So, please answer :) For hotplug and other reasons, the network developers decided that being able to remove a network module at any time was a good thing. It works. Except that for ipv6.ko, it's all opposite. After modprobe, it already got a refcount like 8 and you're wondering how to get rid of that. ipv6 is not a network driver, it is a protocol. You might be able to remove it if you zap all the routes and applications, ... Wouldn't it be enough to down all the interfaces and close all the sockets? No need to bring down every app. You need every socket to close and all routes to go away including the routes through loopback device, and still there probably are control sockets buried inside ipv6 that hold ref count. IMHO the kernel should just admit that IPV6 can't be removed. --- a/net/ipv6/af_inet6.c 2007-09-26 16:28:01.0 -0700 +++ b/net/ipv6/af_inet6.c 2007-09-26 17:38:23.0 -0700 @@ -914,6 +914,9 @@ out_unregister_tcp_proto: } module_init(inet6_init); +/* Disabled at present because it is impossible to remove all references */ +#ifdef IPV6_UNLOAD + static void __exit inet6_exit(void) { /* First of all disallow new sockets creation. */ @@ -952,5 +955,6 @@ static void __exit inet6_exit(void) proto_unregister(tcpv6_prot); } module_exit(inet6_exit); +#endif MODULE_ALIAS_NETPROTO(PF_INET6); --- a/net/ipv6/addrconf.c 2007-09-26 15:07:35.0 -0700 +++ b/net/ipv6/addrconf.c 2007-09-26 17:36:52.0 -0700 @@ -4255,6 +4255,7 @@ errout: return err; } +#ifdef IPV6_UNLOAD void __exit addrconf_cleanup(void) { struct net_device *dev; @@ -4308,3 +4309,4 @@ void __exit addrconf_cleanup(void) proc_net_remove(init_net, if_inet6); #endif } +#endif --- a/net/ipv6/ipv6_sockglue.c 2007-09-26 15:07:35.0 -0700 +++ b/net/ipv6/ipv6_sockglue.c 2007-09-26 17:36:17.0 -0700 @@ -1132,7 +1132,9 @@ void __init ipv6_packet_init(void) dev_add_pack(ipv6_packet_type); } -void ipv6_packet_cleanup(void) +#ifdef IPV6_UNLOAD +void __exit ipv6_packet_cleanup(void) { dev_remove_pack(ipv6_packet_type); } +#endif - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Sep 27 2007 07:51, Stephen Hemminger wrote: You need every socket to close and all routes to go away including the routes through loopback device, and still there probably are control sockets buried inside ipv6 that hold ref count. IMHO the kernel should just admit that IPV6 can't be removed. I cannot accept that. If ipv6.ko has a way to tack ipv6 structs onto all sockets, interfaces and addresses, it should also be able to untack it again. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
Sounds like a module utilities problem since unloading one module doesn't normally unload others. I have to disagree here - 'modprobe -r' is specifically unloading all modules the specified one references as long as they have a use count of zero. The difference to other networking modules is that the latter normally don't export symbols, and hence don't have dependent modules (and thus cannot be subject of implicit unloading). Bridge does have dependents, and hence must avoid implicit unloading by managing its use count. I want keep the behavior that: modprobe -r bridge removes all bridges. It is too useful and may already be in some user scripts. So we have an unsolvable problem here then, unless infrastructure gets added that allows a module to declare itself as not-implicit-unload-safe, forcing modprobe -r to keep its hands off it. Ugly. Jan - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
Jan Beulich [EMAIL PROTECTED] wrote: So we have an unsolvable problem here then, unless infrastructure gets added that allows a module to declare itself as not-implicit-unload-safe, forcing modprobe -r to keep its hands off it. Ugly. Yes I've always wanted to have a separate count that indicates a module is in use but does not prevent its immediate removal. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Thu, 27 Sep 2007 00:18:55 +0200 (CEST) Jan Engelhardt <[EMAIL PROTECTED]> wrote: > > On Sep 26 2007 14:06, Stephen Hemminger wrote: > >> > > >> > No, network devices don't do reference counting. > >> > >> Could you explain why, please? > >> > >> After `udevd` on boot loads lots of unused crap, i surrendered, and use > >> $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, > >> there are lots of configs: udev, hotplug, modprobe, that somebody might > >> like to fix. But it came to the end with me. I just don't care. So, > >> please answer :) > > > >For hotplug and other reasons, the network developers decided that being > >able to remove a network module at any time was a good thing. It works. > > Except that for ipv6.ko, it's all opposite. After modprobe, > it already got a refcount like 8 and you're wondering how > to get rid of that. ipv6 is not a network driver, it is a protocol. You might be able to remove it if you zap all the routes and applications, ... -- Stephen Hemminger <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Sep 26 2007 14:06, Stephen Hemminger wrote: >> > >> > No, network devices don't do reference counting. >> >> Could you explain why, please? >> >> After `udevd` on boot loads lots of unused crap, i surrendered, and use >> $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, >> there are lots of configs: udev, hotplug, modprobe, that somebody might >> like to fix. But it came to the end with me. I just don't care. So, >> please answer :) > >For hotplug and other reasons, the network developers decided that being >able to remove a network module at any time was a good thing. It works. Except that for ipv6.ko, it's all opposite. After modprobe, it already got a refcount like 8 and you're wondering how to get rid of that. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Wed, 26 Sep 2007 23:06:53 +0200 Oleg Verych <[EMAIL PROTECTED]> wrote: > * Wed, 26 Sep 2007 08:37:05 -0700 > * Organization: Linux Foundation > > > > On Wed, 26 Sep 2007 08:53:27 +0100 > > "Jan Beulich" <[EMAIL PROTECTED]> wrote: > > > >> Otherwise 'modprobe -r' on a module having a dependency on bridge will > >> implicitly unload bridge, bringing down all connectivity that was > >> using bridges. > >> > >> Signed-off-by: Jan Beulich <[EMAIL PROTECTED]> > >> > > > > No, network devices don't do reference counting. > > Could you explain why, please? > > After `udevd` on boot loads lots of unused crap, i surrendered, and use > $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, > there are lots of configs: udev, hotplug, modprobe, that somebody might > like to fix. But it came to the end with me. I just don't care. So, > please answer :) > For hotplug and other reasons, the network developers decided that being able to remove a network module at any time was a good thing. It works. -- Stephen Hemminger <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
* Wed, 26 Sep 2007 08:37:05 -0700 * Organization: Linux Foundation > > On Wed, 26 Sep 2007 08:53:27 +0100 > "Jan Beulich" <[EMAIL PROTECTED]> wrote: > >> Otherwise 'modprobe -r' on a module having a dependency on bridge will >> implicitly unload bridge, bringing down all connectivity that was >> using bridges. >> >> Signed-off-by: Jan Beulich <[EMAIL PROTECTED]> >> > > No, network devices don't do reference counting. Could you explain why, please? After `udevd` on boot loads lots of unused crap, i surrendered, and use $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, there are lots of configs: udev, hotplug, modprobe, that somebody might like to fix. But it came to the end with me. I just don't care. So, please answer :) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
On Wed, 26 Sep 2007 08:53:27 +0100 "Jan Beulich" <[EMAIL PROTECTED]> wrote: > Otherwise 'modprobe -r' on a module having a dependency on bridge will > implicitly unload bridge, bringing down all connectivity that was > using bridges. > > Signed-off-by: Jan Beulich <[EMAIL PROTECTED]> > No, network devices don't do reference counting. What is the dependency? Where is the source of the module interacting with the bridge? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Module use count must be updated as bridges are created/destroyed
Otherwise 'modprobe -r' on a module having a dependency on bridge will implicitly unload bridge, bringing down all connectivity that was using bridges. Signed-off-by: Jan Beulich <[EMAIL PROTECTED]> net/bridge/br_if.c |9 + 1 file changed, 9 insertions(+) --- linux-2.6.23-rc8/net/bridge/br_if.c 2007-09-26 09:23:54.0 +0200 +++ 2.6.23-rc8-bridge-module-get-put/net/bridge/br_if.c 2007-09-25 14:31:01.0 +0200 @@ -276,6 +276,11 @@ int br_add_bridge(const char *name) if (!dev) return -ENOMEM; + if (!try_module_get(THIS_MODULE)) { + free_netdev(dev); + return -ENOENT; + } + rtnl_lock(); if (strchr(dev->name, '%')) { ret = dev_alloc_name(dev, dev->name); @@ -294,6 +299,8 @@ int br_add_bridge(const char *name) unregister_netdevice(dev); out: rtnl_unlock(); + if (ret) + module_put(THIS_MODULE); return ret; } @@ -321,6 +328,8 @@ int br_del_bridge(const char *name) del_br(netdev_priv(dev)); rtnl_unlock(); + if (ret == 0) + module_put(THIS_MODULE); return ret; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Module use count must be updated as bridges are created/destroyed
Otherwise 'modprobe -r' on a module having a dependency on bridge will implicitly unload bridge, bringing down all connectivity that was using bridges. Signed-off-by: Jan Beulich [EMAIL PROTECTED] net/bridge/br_if.c |9 + 1 file changed, 9 insertions(+) --- linux-2.6.23-rc8/net/bridge/br_if.c 2007-09-26 09:23:54.0 +0200 +++ 2.6.23-rc8-bridge-module-get-put/net/bridge/br_if.c 2007-09-25 14:31:01.0 +0200 @@ -276,6 +276,11 @@ int br_add_bridge(const char *name) if (!dev) return -ENOMEM; + if (!try_module_get(THIS_MODULE)) { + free_netdev(dev); + return -ENOENT; + } + rtnl_lock(); if (strchr(dev-name, '%')) { ret = dev_alloc_name(dev, dev-name); @@ -294,6 +299,8 @@ int br_add_bridge(const char *name) unregister_netdevice(dev); out: rtnl_unlock(); + if (ret) + module_put(THIS_MODULE); return ret; } @@ -321,6 +328,8 @@ int br_del_bridge(const char *name) del_br(netdev_priv(dev)); rtnl_unlock(); + if (ret == 0) + module_put(THIS_MODULE); return ret; } - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Module use count must be updated as bridges are created/destroyed
On Wed, 26 Sep 2007 08:53:27 +0100 Jan Beulich [EMAIL PROTECTED] wrote: Otherwise 'modprobe -r' on a module having a dependency on bridge will implicitly unload bridge, bringing down all connectivity that was using bridges. Signed-off-by: Jan Beulich [EMAIL PROTECTED] No, network devices don't do reference counting. What is the dependency? Where is the source of the module interacting with the bridge? - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
* Wed, 26 Sep 2007 08:37:05 -0700 * Organization: Linux Foundation On Wed, 26 Sep 2007 08:53:27 +0100 Jan Beulich [EMAIL PROTECTED] wrote: Otherwise 'modprobe -r' on a module having a dependency on bridge will implicitly unload bridge, bringing down all connectivity that was using bridges. Signed-off-by: Jan Beulich [EMAIL PROTECTED] No, network devices don't do reference counting. Could you explain why, please? After `udevd` on boot loads lots of unused crap, i surrendered, and use $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, there are lots of configs: udev, hotplug, modprobe, that somebody might like to fix. But it came to the end with me. I just don't care. So, please answer :) - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Wed, 26 Sep 2007 23:06:53 +0200 Oleg Verych [EMAIL PROTECTED] wrote: * Wed, 26 Sep 2007 08:37:05 -0700 * Organization: Linux Foundation On Wed, 26 Sep 2007 08:53:27 +0100 Jan Beulich [EMAIL PROTECTED] wrote: Otherwise 'modprobe -r' on a module having a dependency on bridge will implicitly unload bridge, bringing down all connectivity that was using bridges. Signed-off-by: Jan Beulich [EMAIL PROTECTED] No, network devices don't do reference counting. Could you explain why, please? After `udevd` on boot loads lots of unused crap, i surrendered, and use $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, there are lots of configs: udev, hotplug, modprobe, that somebody might like to fix. But it came to the end with me. I just don't care. So, please answer :) For hotplug and other reasons, the network developers decided that being able to remove a network module at any time was a good thing. It works. -- Stephen Hemminger [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Sep 26 2007 14:06, Stephen Hemminger wrote: No, network devices don't do reference counting. Could you explain why, please? After `udevd` on boot loads lots of unused crap, i surrendered, and use $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, there are lots of configs: udev, hotplug, modprobe, that somebody might like to fix. But it came to the end with me. I just don't care. So, please answer :) For hotplug and other reasons, the network developers decided that being able to remove a network module at any time was a good thing. It works. Except that for ipv6.ko, it's all opposite. After modprobe, it already got a refcount like 8 and you're wondering how to get rid of that. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
On Thu, 27 Sep 2007 00:18:55 +0200 (CEST) Jan Engelhardt [EMAIL PROTECTED] wrote: On Sep 26 2007 14:06, Stephen Hemminger wrote: No, network devices don't do reference counting. Could you explain why, please? After `udevd` on boot loads lots of unused crap, i surrendered, and use $(rmmod `lsmod | just first column`). Networing bravely wipes away. OK, there are lots of configs: udev, hotplug, modprobe, that somebody might like to fix. But it came to the end with me. I just don't care. So, please answer :) For hotplug and other reasons, the network developers decided that being able to remove a network module at any time was a good thing. It works. Except that for ipv6.ko, it's all opposite. After modprobe, it already got a refcount like 8 and you're wondering how to get rid of that. ipv6 is not a network driver, it is a protocol. You might be able to remove it if you zap all the routes and applications, ... -- Stephen Hemminger [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/