diff options
author | Patrick McHardy <kaber@trash.net> | 2006-11-29 20:34:50 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:31:40 -0500 |
commit | 814a175e7b1531a4bcaa63be47bf58cacdcb5010 (patch) | |
tree | c2d52dbaa3c7d586da3d1859b0d572a02b31fc2b /net | |
parent | 6cbda6b6e2e2a0a84c0fcda8ea262c16d7a63fc8 (diff) |
[NET_SCHED]: sch_htb: perform qlen adjustment immediately in ->delete
qlen adjustment should happen immediately in ->delete and not in the
class destroy function because the reference count will not hit zero in
->delete (sch_api holds a reference) but in ->put. Since the qdisc
lock is released between deletion of the class and final destruction
this creates an externally visible error in the qlen counter.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sched/sch_htb.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 4b52fa78935a..08fa4d083615 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1269,9 +1269,9 @@ static void htb_destroy_filters(struct tcf_proto **fl) | |||
1269 | static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl) | 1269 | static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl) |
1270 | { | 1270 | { |
1271 | struct htb_sched *q = qdisc_priv(sch); | 1271 | struct htb_sched *q = qdisc_priv(sch); |
1272 | |||
1272 | if (!cl->level) { | 1273 | if (!cl->level) { |
1273 | BUG_TRAP(cl->un.leaf.q); | 1274 | BUG_TRAP(cl->un.leaf.q); |
1274 | sch->q.qlen -= cl->un.leaf.q->q.qlen; | ||
1275 | qdisc_destroy(cl->un.leaf.q); | 1275 | qdisc_destroy(cl->un.leaf.q); |
1276 | } | 1276 | } |
1277 | qdisc_put_rtab(cl->rate); | 1277 | qdisc_put_rtab(cl->rate); |
@@ -1334,6 +1334,11 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg) | |||
1334 | /* delete from hash and active; remainder in destroy_class */ | 1334 | /* delete from hash and active; remainder in destroy_class */ |
1335 | hlist_del_init(&cl->hlist); | 1335 | hlist_del_init(&cl->hlist); |
1336 | 1336 | ||
1337 | if (!cl->level) { | ||
1338 | sch->q.qlen -= cl->un.leaf.q->q.qlen; | ||
1339 | qdisc_reset(cl->un.leaf.q); | ||
1340 | } | ||
1341 | |||
1337 | if (cl->prio_activity) | 1342 | if (cl->prio_activity) |
1338 | htb_deactivate(q, cl); | 1343 | htb_deactivate(q, cl); |
1339 | 1344 | ||