summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-12-05 07:22:13 +0300
committerJakub Kicinski <kuba@kernel.org>2021-12-07 03:05:12 +0300
commit606509f27f67748b92f783a75a6e39cfaa2fe92d (patch)
tree15b7e006aad92180f02da94a9d6c6be7f03054d5
parentc04438f58d140723e58050fcb9d33d84cb39e9e9 (diff)
downloadlinux-606509f27f67748b92f783a75a6e39cfaa2fe92d.tar.xz
net/sched: add net device refcount tracker to struct Qdisc
Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--include/net/sch_generic.h2
-rw-r--r--net/sched/sch_generic.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 22179b2fda72..dbf202bb1a0e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -125,7 +125,7 @@ struct Qdisc {
spinlock_t seqlock;
struct rcu_head rcu;
-
+ netdevice_tracker dev_tracker;
/* private data */
long privdata[] ____cacheline_aligned;
};
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index d33804d41c5c..8c8fbf2e3856 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -973,7 +973,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
sch->enqueue = ops->enqueue;
sch->dequeue = ops->dequeue;
sch->dev_queue = dev_queue;
- dev_hold(dev);
+ dev_hold_track(dev, &sch->dev_tracker, GFP_KERNEL);
refcount_set(&sch->refcnt, 1);
return sch;
@@ -1073,7 +1073,7 @@ static void qdisc_destroy(struct Qdisc *qdisc)
ops->destroy(qdisc);
module_put(ops->owner);
- dev_put(qdisc_dev(qdisc));
+ dev_put_track(qdisc_dev(qdisc), &qdisc->dev_tracker);
trace_qdisc_destroy(qdisc);