From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Helge Hafting <helge.hafting@aitel.hist.no>
Cc: Jan Engelhardt <jengelh@computergmbh.de>,
Oleg Verych <olecom@flower.upol.cz>,
Jan Beulich <jbeulich@novell.com>,
bridge@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed)
Date: Thu, 27 Sep 2007 07:51:02 -0700 [thread overview]
Message-ID: <20070927075102.4335a263@freepuppy.rosehill> (raw)
In-Reply-To: <46FB99EF.4020806@aitel.hist.no>
On Thu, 27 Sep 2007 13:54:23 +0200
Helge Hafting <helge.hafting@aitel.hist.no> wrote:
> Stephen Hemminger wrote:
> > On Thu, 27 Sep 2007 00:18:55 +0200 (CEST)
> > Jan Engelhardt <jengelh@computergmbh.de> 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.000000000 -0700
+++ b/net/ipv6/af_inet6.c 2007-09-26 17:38:23.000000000 -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.000000000 -0700
+++ b/net/ipv6/addrconf.c 2007-09-26 17:36:52.000000000 -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.000000000 -0700
+++ b/net/ipv6/ipv6_sockglue.c 2007-09-26 17:36:17.000000000 -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
next prev parent reply other threads:[~2007-09-27 14:51 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-26 7:53 [PATCH] Module use count must be updated as bridges are created/destroyed Jan Beulich
2007-09-26 15:37 ` Stephen Hemminger
2007-09-26 21:06 ` why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed) Oleg Verych
2007-09-26 21:06 ` Stephen Hemminger
2007-09-26 22:18 ` Jan Engelhardt
2007-09-26 22:33 ` Stephen Hemminger
2007-09-26 22:57 ` why network devices don't do reference counting? David Miller
2007-09-27 11:54 ` why network devices don't do reference counting? (Re: [PATCH] Module use count must be updated as bridges are created/destroyed) Helge Hafting
2007-09-27 14:51 ` Stephen Hemminger [this message]
2007-09-27 14:55 ` Jan Engelhardt
2007-09-27 19:15 ` why network devices don't do reference counting? David Miller
2007-09-27 19:01 ` David Miller
[not found] ` <46FAA013.76E4.0078.0@novell.com>
[not found] ` <20070926101252.3ccbb987@freepuppy.rosehill>
2007-09-27 7:40 ` [PATCH] Module use count must be updated as bridges are created/destroyed Jan Beulich
2007-09-27 14:48 ` Stephen Hemminger
2007-09-27 15:05 ` Jan Beulich
2007-09-28 5:37 ` Herbert Xu
2007-09-28 18:11 ` Stephen Hemminger
2007-09-29 0:55 ` Herbert Xu
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=20070927075102.4335a263@freepuppy.rosehill \
--to=shemminger@linux-foundation.org \
--cc=bridge@lists.linux-foundation.org \
--cc=helge.hafting@aitel.hist.no \
--cc=jbeulich@novell.com \
--cc=jengelh@computergmbh.de \
--cc=linux-kernel@vger.kernel.org \
--cc=olecom@flower.upol.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®