From: Andrew Morton <akpm@osdl.org>
To: netdev@oss.sgi.com
Cc: Felix Palmen <fmp@palmen.homeip.net>
Subject: Fw: unregister_netdevice(): negative refcnt, suggest patch against 2.6.11
Date: Sun, 10 Apr 2005 03:44:46 -0700 [thread overview]
Message-ID: <20050410034446.39e3025e.akpm@osdl.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2280 bytes --]
That sounds like a bug in appletalk or in the tap driver. Please describe
a means by which other developers can reproduce that bug (a sequence of
shell commands would be ideal).
Thanks.
Begin forwarded message:
Date: Sun, 10 Apr 2005 11:16:25 +0200
From: Felix Palmen <fmp@palmen.homeip.net>
To: linux-kernel@vger.kernel.org
Subject: unregister_netdevice(): negative refcnt, suggest patch against 2.6.11
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: signature.asc --]
[-- Type: application/pgp-signature, Size: 308 bytes --]
next reply other threads:[~2005-04-10 10:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-10 10:44 Andrew Morton [this message]
2005-04-10 21:27 ` Fw: unregister_netdevice(): negative refcnt, suggest patch against 2.6.11 Felix Palmen
2005-04-10 21:50 ` Thomas Graf
2005-04-11 2:30 ` Felix Palmen
2005-04-11 12:51 ` Thomas Graf
2005-04-18 2:07 ` Herbert Xu
2005-04-18 8:09 ` Herbert Xu
2005-04-18 14:48 ` Arnaldo Carvalho de Melo
2005-04-18 10:17 ` Thomas Graf
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=20050410034446.39e3025e.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=fmp@palmen.homeip.net \
--cc=netdev@oss.sgi.com \
/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;
as well as URLs for NNTP newsgroup(s).