* unregister_netdevice(): negative refcnt, suggest patch against 2.6.11
@ 2005-04-10 9:16 Felix Palmen
2005-04-10 14:18 ` Felix Palmen
0 siblings, 1 reply; 2+ messages in thread
From: Felix Palmen @ 2005-04-10 9:16 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1920 bytes --]
Hi lkml-members,
I recently had a problem with appletalk. After starting atalkd on a TAP
interface and stopping it later, unregister_netdevice() just stated
| unregister_netdevice: waiting for tap0 to become free. Usage count = -1
So I assume there is a problem in the appletalk code, but I didn't try
reproducing that on other systems so far.
I changed my kernel to "correct" a negative refcnt to 0 and that kind
of fixes the problem. I'm not sure whether this could break anything,
but certainly waiting for a device to become free is no use when there
is a negative number of users, so I think it would be better to allow
the system to shut down cleanly in this case.
Here's m suggestion:
#v+
--- linux-2.6.11-orig/net/core/dev.c 2005-03-02 08:38:09.000000000 +0100
+++ linux-2.6.11/net/core/dev.c 2005-04-09 16:44:42.000000000 +0200
@@ -2876,7 +2876,7 @@
unsigned long rebroadcast_time, warning_time;
rebroadcast_time = warning_time = jiffies;
- while (atomic_read(&dev->refcnt) != 0) {
+ while (atomic_read(&dev->refcnt) > 0) {
if (time_after(jiffies, rebroadcast_time + 1 * HZ)) {
rtnl_shlock();
@@ -2910,6 +2910,13 @@
warning_time = jiffies;
}
}
+ if (atomic_read(&dev->refcnt) != 0) {
+ printk(KERN_ERR "unregister_netdevice: "
+ "%s has negative refcnt (%d). "
+ "This should never happen! Setting refcnt to 0.\n",
+ dev->name, atomic_read(&dev->refcnt));
+ atomic_set(&dev->refcnt, 0);
+ }
}
/* The sequence is:
#v-
Greets, Felix
PS: Please note I'm not subscribed to lkml and CC me in replies, thanks.
--
| /"\ ASCII Ribbon | Felix M. Palmen (Zirias) http://zirias.ath.cx/ |
| \ / Campaign Against | fmp@palmen.homeip.net encrypted mail welcome |
| X HTML In Mail | PGP key: http://zirias.ath.cx/pub.txt |
| / \ And News | ED9B 62D0 BE39 32F9 2488 5D0C 8177 9D80 5ECF F683 |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 307 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: unregister_netdevice(): negative refcnt, suggest patch against 2.6.11
2005-04-10 9:16 unregister_netdevice(): negative refcnt, suggest patch against 2.6.11 Felix Palmen
@ 2005-04-10 14:18 ` Felix Palmen
0 siblings, 0 replies; 2+ messages in thread
From: Felix Palmen @ 2005-04-10 14:18 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]
* Felix M. Palmen <fmp@palmen.homeip.net> [20050410 11:16]:
> So I assume there is a problem in the appletalk code, but I didn't try
> reproducing that on other systems so far.
I've now tested this issue on a vanilla 2.6.11.7 kernel. I only applied
my own patch from the previous post so that I am able to shut down the
computer cleanly. So I did the following:
- boot 2.6.11.7
- create a tap device with 'openvpn --mktun --dev tap0'
- create /etc/netatalk/atalkd.conf with a single line 'tap0'
- launch atalkd, wait.
- stop atalkd.
- destroy tap device with 'openvpn --rmtun --dev tap0'
refcnt was -256, very strange.
Would you consider my patch harmful? I intend using it for now, because
otherwise, my system won't shut down cleanly any more...
Greets, Felix
PS: Please CC replies to me.
--
| /"\ ASCII Ribbon | Felix M. Palmen (Zirias) http://zirias.ath.cx/ |
| \ / Campaign Against | fmp@palmen.homeip.net encrypted mail welcome |
| X HTML In Mail | PGP key: http://zirias.ath.cx/pub.txt |
| / \ And News | ED9B 62D0 BE39 32F9 2488 5D0C 8177 9D80 5ECF F683 |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 307 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-10 14:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-10 9:16 unregister_netdevice(): negative refcnt, suggest patch against 2.6.11 Felix Palmen
2005-04-10 14:18 ` Felix Palmen
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®