]> git.baikalelectronics.ru Git - kernel.git/commit
net_sched: fix THROTTLED/RUNNING race
authorEric Dumazet <eric.dumazet@gmail.com>
Thu, 24 Mar 2011 07:13:14 +0000 (00:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Mar 2011 07:13:14 +0000 (00:13 -0700)
commit86bdf81b16d30849239600c4467419fba2c6faf1
tree6323cffca24cba664cd57a7245eb78647c48b914
parente4fc54c7ed163fb9f125a057fe95a6055f0516e9
net_sched: fix THROTTLED/RUNNING race

commit 0ab3c22af07f (net_sched: move TCQ_F_THROTTLED flag)
added a race.

qdisc_watchdog() is run from softirq, so special care should be taken or
we can lose one state transition (THROTTLED/RUNNING)

Prior to 0ab3c22af07f, we were manipulating q->flags (qdisc->flags &=
~TCQ_F_THROTTLED;) and this manipulation could only race with
qdisc_warn_nonwc().

Since we want to avoid atomic ops in qdisc fast path - it was the
meaning of commit d688f330a4744 (QDISC_STATE_RUNNING dont need atomic
bit ops) - fix is to move THROTTLE bit into 'state' field, this one
being manipulated with SMP and IRQ safe operations.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sch_generic.h