From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Stephen Hemminger <shemminger@osdl.org>,
Linux Netdev List <netdev@vger.kernel.org>
Subject: [NET_SCHED 07/06]: Fix endless loops (part 5): netem/tbf/hfsc ->requeue failures
Date: Mon, 20 Nov 2006 16:01:03 +0100 [thread overview]
Message-ID: <4561C32F.7000702@trash.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 57 bytes --]
I forgot to fix one (AFAICT purely theoretical) case ..
[-- Attachment #2: 07.diff --]
[-- Type: text/plain, Size: 2403 bytes --]
[NET_SCHED]: Fix endless loops (part 5): netem/tbf/hfsc ->requeue failures
When peeking at the next packet in a child qdisc by calling dequeue/requeue,
the upper qdisc qlen counter may get out of sync in case the requeue fails.
The qdisc and the child qdisc both have their counter decremented, but since
no packet is given to the upper qdisc it won't decrement its counter itself.
requeue should not fail, so this is mostly for "correctness".
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 929cc41d7993cf356bcf1693c924e016df55a6a9
tree 8d0017e51e6285b4d584864e564e4d4512463b99
parent cc6f4de81d666f76192bee629473ff6fbd66286c
author Patrick McHardy <kaber@trash.net> Mon, 20 Nov 2006 15:59:14 +0100
committer Patrick McHardy <kaber@trash.net> Mon, 20 Nov 2006 15:59:14 +0100
net/sched/sch_hfsc.c | 1 +
net/sched/sch_netem.c | 5 +----
net/sched/sch_tbf.c | 2 +-
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 2d43744..6eefa69 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -946,6 +946,7 @@ qdisc_peek_len(struct Qdisc *sch)
if (unlikely(sch->ops->requeue(skb, sch) != NET_XMIT_SUCCESS)) {
if (net_ratelimit())
printk("qdisc_peek_len: failed to requeue\n");
+ qdisc_tree_decrease_qlen(sch, 1);
return 0;
}
return len;
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 672c354..79542af 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -287,13 +287,10 @@ static struct sk_buff *netem_dequeue(str
psched_tdiff_t delay = PSCHED_TDIFF(cb->time_to_send, now);
if (q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS) {
+ qdisc_tree_decrease_qlen(q->qdisc, 1);
sch->qstats.drops++;
-
- /* After this qlen is confused */
printk(KERN_ERR "netem: queue discpline %s could not requeue\n",
q->qdisc->ops->id);
-
- sch->q.qlen--;
}
mod_timer(&q->timer, jiffies + PSCHED_US2JIFFIE(delay));
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 23b7624..ed9b6d9 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -250,7 +250,7 @@ static struct sk_buff *tbf_dequeue(struc
if (q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS) {
/* When requeue fails skb is dropped */
- sch->q.qlen--;
+ qdisc_tree_decrease_qlen(q->qdisc, 1);
sch->qstats.drops++;
}
next reply other threads:[~2006-11-20 15:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-20 15:01 Patrick McHardy [this message]
2006-11-20 18:08 ` [NET_SCHED 07/06]: Fix endless loops (part 5): netem/tbf/hfsc ->requeue failures Stephen Hemminger
2006-11-30 1:37 ` David Miller
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=4561C32F.7000702@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@osdl.org \
/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).