From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Nuno Silva <nuno.silva@vgertech.com>,
linux-kernel@vger.kernel.org, master@sectorb.msk.ru,
netdev@oss.sgi.com
Subject: Re: 2.6.8-rc4-bk1 problem: unregister_netdevice: waiting for ppp0 to become free. Usage count = 1
Date: Sun, 22 Aug 2004 14:39:57 +0200 [thread overview]
Message-ID: <4128941D.9030000@trash.net> (raw)
In-Reply-To: <E1BynUy-0007t1-00@gondolin.me.apana.org.au>
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
Herbert Xu wrote:
>Nuno Silva <nuno.silva@vgertech.com> wrote:
>
>
>>The problem is in the QoS code. If I start ppp whithout the
>>
>>
>
>OK, this appears to be due to the changeset titled
>
>[PKT_SCHED]: Refcount qdisc->dev for __qdisc_destroy rcu-callback
>
>It adds a reference to dev.
>
>I don't see any code that cleans up that reference when the dev goes
>down. So someone needs to add that similar to the code in net/core/dst.c.
>
>Patrick, could you please have a look at this?
>
>
The reference is dropped in __qdisc_destroy. The problem lies in the CBQ
qdisc, it doesn't destroy the root-class and leaks the inner qdisc. These
two patches for 2.4 and 2.6 fix the problem.
Regards
Patrick
[-- Attachment #2: 01-2.4-cbq-leaks.diff --]
[-- Type: text/x-patch, Size: 1438 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/22 14:37:58+02:00 kaber@coreworks.de
# [PKT_SCHED]: Fix class leak in CBQ scheduler
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/sched/sch_cbq.c
# 2004/08/22 14:37:27+02:00 kaber@coreworks.de +8 -6
# [PKT_SCHED]: Fix class leak in CBQ scheduler
#
diff -Nru a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
--- a/net/sched/sch_cbq.c 2004-08-22 14:38:18 +02:00
+++ b/net/sched/sch_cbq.c 2004-08-22 14:38:18 +02:00
@@ -1712,15 +1712,18 @@
}
}
-static void cbq_destroy_class(struct cbq_class *cl)
+static void cbq_destroy_class(struct Qdisc *sch, struct cbq_class *cl)
{
+ struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+
cbq_destroy_filters(cl);
qdisc_destroy(cl->q);
qdisc_put_rtab(cl->R_tab);
#ifdef CONFIG_NET_ESTIMATOR
qdisc_kill_estimator(&cl->stats);
#endif
- kfree(cl);
+ if (cl != &q->link)
+ kfree(cl);
}
static void
@@ -1743,8 +1746,7 @@
for (cl = q->classes[h]; cl; cl = next) {
next = cl->next;
- if (cl != &q->link)
- cbq_destroy_class(cl);
+ cbq_destroy_class(sch, cl);
}
}
@@ -1766,7 +1768,7 @@
spin_unlock_bh(&sch->dev->queue_lock);
#endif
- cbq_destroy_class(cl);
+ cbq_destroy_class(sch, cl);
}
}
@@ -2000,7 +2002,7 @@
sch_tree_unlock(sch);
if (--cl->refcnt == 0)
- cbq_destroy_class(cl);
+ cbq_destroy_class(sch, cl);
return 0;
}
[-- Attachment #3: 01-2.6-cbq-leaks.diff --]
[-- Type: text/x-patch, Size: 1419 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/22 14:30:32+02:00 kaber@coreworks.de
# [PKT_SCHED]: Fix class leak in CBQ scheduler
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/sched/sch_cbq.c
# 2004/08/22 14:30:13+02:00 kaber@coreworks.de +8 -6
# [PKT_SCHED]: Fix class leak in CBQ scheduler
#
diff -Nru a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
--- a/net/sched/sch_cbq.c 2004-08-22 14:33:59 +02:00
+++ b/net/sched/sch_cbq.c 2004-08-22 14:33:59 +02:00
@@ -1746,15 +1746,18 @@
}
}
-static void cbq_destroy_class(struct cbq_class *cl)
+static void cbq_destroy_class(struct Qdisc *sch, struct cbq_class *cl)
{
+ struct cbq_sched_data *q = qdisc_priv(sch);
+
cbq_destroy_filters(cl);
qdisc_destroy(cl->q);
qdisc_put_rtab(cl->R_tab);
#ifdef CONFIG_NET_ESTIMATOR
qdisc_kill_estimator(&cl->stats);
#endif
- kfree(cl);
+ if (cl != &q->link)
+ kfree(cl);
}
static void
@@ -1777,8 +1780,7 @@
for (cl = q->classes[h]; cl; cl = next) {
next = cl->next;
- if (cl != &q->link)
- cbq_destroy_class(cl);
+ cbq_destroy_class(sch, cl);
}
}
@@ -1799,7 +1801,7 @@
spin_unlock_bh(&sch->dev->queue_lock);
#endif
- cbq_destroy_class(cl);
+ cbq_destroy_class(sch, cl);
}
}
@@ -2035,7 +2037,7 @@
sch_tree_unlock(sch);
if (--cl->refcnt == 0)
- cbq_destroy_class(cl);
+ cbq_destroy_class(sch, cl);
return 0;
}
next prev parent reply other threads:[~2004-08-22 12:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <411BC284.6080807@vgertech.com>
2004-08-13 8:03 ` 2.6.8-rc4-bk1 problem: unregister_netdevice: waiting for ppp0 to become free. Usage count = 1 Vladimir B. Savkin
2004-08-13 20:35 ` Nuno Silva
2004-08-22 2:13 ` Nuno Silva
2004-08-22 5:25 ` David S. Miller
2004-08-22 8:02 ` Nuno Silva
2004-08-22 8:14 ` Herbert Xu
2004-08-22 12:39 ` Patrick McHardy [this message]
2004-08-23 4:47 ` David S. Miller
2004-08-26 16:46 ` Jurriaan
2004-08-23 17:56 ` Nuno Silva
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=4128941D.9030000@trash.net \
--to=kaber@trash.net \
--cc=davem@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=master@sectorb.msk.ru \
--cc=netdev@oss.sgi.com \
--cc=nuno.silva@vgertech.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).