Skip to content

Commit 52fbb29

Browse files
edumazetdavem330
authored andcommitted
net: sched: fix qdisc->running lockdep annotations
1) qdisc_run_begin() is really using the equivalent of a trylock. Instead of using write_seqcount_begin(), use a combination of raw_write_seqcount_begin() and correct lockdep annotation. 2) sch_direct_xmit() should use regular spin_lock(root_lock) Fixes: f9eb8ae ("net_sched: transform qdisc running bit into a seqcount") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5362855 commit 52fbb29

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

include/net/sch_generic.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
9797
{
9898
if (qdisc_is_running(qdisc))
9999
return false;
100-
write_seqcount_begin(&qdisc->running);
100+
/* Variant of write_seqcount_begin() telling lockdep a trylock
101+
* was attempted.
102+
*/
103+
raw_write_seqcount_begin(&qdisc->running);
104+
seqcount_acquire(&qdisc->running.dep_map, 0, 1, _RET_IP_);
101105
return true;
102106
}
103107

net/sched/sch_generic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
137137

138138
HARD_TX_UNLOCK(dev, txq);
139139
} else {
140-
spin_lock_nested(root_lock, SINGLE_DEPTH_NESTING);
140+
spin_lock(root_lock);
141141
return qdisc_qlen(q);
142142
}
143-
spin_lock_nested(root_lock, SINGLE_DEPTH_NESTING);
143+
spin_lock(root_lock);
144144

145145
if (dev_xmit_complete(ret)) {
146146
/* Driver sent out skb successfully or skb was consumed */

0 commit comments

Comments
 (0)