Commit 25bfcd5a authored by Jarek Poplawski's avatar Jarek Poplawski Committed by David S. Miller

pkt_sched: Add lockdep annotation for qdisc locks

Qdisc locks are initialized in the same function, qdisc_alloc(), so
lockdep can't distinguish tx qdisc lock from rx and reports "possible
recursive locking detected" when both these locks are taken eg. while
using act_mirred with ifb. This looks like a false positive. Anyway,
after this patch these locks will be reported more exactly.
Reported-by: default avatarDenys Fedoryshchenko <denys@visp.net.lb>
Signed-off-by: default avatarJarek Poplawski <jarkao2@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8608db03
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/hrtimer.h> #include <linux/hrtimer.h>
#include <linux/lockdep.h>
#include <net/net_namespace.h> #include <net/net_namespace.h>
#include <net/sock.h> #include <net/sock.h>
...@@ -707,6 +708,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, ...@@ -707,6 +708,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
return err; return err;
} }
/* lockdep annotation is needed for ingress; egress gets it only for name */
static struct lock_class_key qdisc_tx_lock;
static struct lock_class_key qdisc_rx_lock;
/* /*
Allocate and initialize new qdisc. Allocate and initialize new qdisc.
...@@ -767,6 +772,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, ...@@ -767,6 +772,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
if (handle == TC_H_INGRESS) { if (handle == TC_H_INGRESS) {
sch->flags |= TCQ_F_INGRESS; sch->flags |= TCQ_F_INGRESS;
handle = TC_H_MAKE(TC_H_INGRESS, 0); handle = TC_H_MAKE(TC_H_INGRESS, 0);
lockdep_set_class(qdisc_lock(sch), &qdisc_rx_lock);
} else { } else {
if (handle == 0) { if (handle == 0) {
handle = qdisc_alloc_handle(dev); handle = qdisc_alloc_handle(dev);
...@@ -774,6 +780,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, ...@@ -774,6 +780,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
if (handle == 0) if (handle == 0)
goto err_out3; goto err_out3;
} }
lockdep_set_class(qdisc_lock(sch), &qdisc_tx_lock);
} }
sch->handle = handle; sch->handle = handle;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment