Skip to content

Commit a7a15f3

Browse files
congwangPaolo Abeni
authored andcommitted
sch_ets: make est_qlen_notify() idempotent
est_qlen_notify() deletes its class from its active list with list_del() when qlen is 0, therefore, it is not idempotent and not friendly to its callers, like fq_codel_dequeue(). Let's make it idempotent to ease qdisc_tree_reduce_backlog() callers' life. Also change other list_del()'s to list_del_init() just to be extra safe. Reported-by: Gerrard Tai <[email protected]> Signed-off-by: Cong Wang <[email protected]> Link: https://patch.msgid.link/[email protected] Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 55f9eca commit a7a15f3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/sched/sch_ets.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static void ets_class_qlen_notify(struct Qdisc *sch, unsigned long arg)
293293
* to remove them.
294294
*/
295295
if (!ets_class_is_strict(q, cl) && sch->q.qlen)
296-
list_del(&cl->alist);
296+
list_del_init(&cl->alist);
297297
}
298298

299299
static int ets_class_dump(struct Qdisc *sch, unsigned long arg,
@@ -488,7 +488,7 @@ static struct sk_buff *ets_qdisc_dequeue(struct Qdisc *sch)
488488
if (unlikely(!skb))
489489
goto out;
490490
if (cl->qdisc->q.qlen == 0)
491-
list_del(&cl->alist);
491+
list_del_init(&cl->alist);
492492
return ets_qdisc_dequeue_skb(sch, skb);
493493
}
494494

@@ -657,7 +657,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
657657
}
658658
for (i = q->nbands; i < oldbands; i++) {
659659
if (i >= q->nstrict && q->classes[i].qdisc->q.qlen)
660-
list_del(&q->classes[i].alist);
660+
list_del_init(&q->classes[i].alist);
661661
qdisc_tree_flush_backlog(q->classes[i].qdisc);
662662
}
663663
WRITE_ONCE(q->nstrict, nstrict);
@@ -713,7 +713,7 @@ static void ets_qdisc_reset(struct Qdisc *sch)
713713

714714
for (band = q->nstrict; band < q->nbands; band++) {
715715
if (q->classes[band].qdisc->q.qlen)
716-
list_del(&q->classes[band].alist);
716+
list_del_init(&q->classes[band].alist);
717717
}
718718
for (band = 0; band < q->nbands; band++)
719719
qdisc_reset(q->classes[band].qdisc);

0 commit comments

Comments
 (0)