Skip to content

Commit

Permalink
net: sched: fix logic error in qdisc_run_begin()
Browse files Browse the repository at this point in the history
For non TCQ_F_NOLOCK qdisc, qdisc_run_begin() tries to set
__QDISC_STATE_RUNNING and should return true if the bit was not set.

test_and_set_bit() returns old bit value, therefore we need to invert.

Fixes: 29cbcd8 ("net: sched: Remove Qdisc::running sequence counter")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Tested-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Eric Dumazet authored and Jakub Kicinski committed Oct 19, 2021
1 parent 05be946 commit 4c57e2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
*/
return spin_trylock(&qdisc->seqlock);
}
return test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
return !test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
}

static inline void qdisc_run_end(struct Qdisc *qdisc)
Expand Down

0 comments on commit 4c57e2f

Please sign in to comment.