]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net/sched: add net device refcount tracker to struct Qdisc
authorEric Dumazet <edumazet@google.com>
Sun, 5 Dec 2021 04:22:13 +0000 (20:22 -0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 7 Dec 2021 00:05:12 +0000 (16:05 -0800)
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/sch_generic.h
net/sched/sch_generic.c

index 22179b2fda72a0a1c2fddc07eeda40716a443a46..dbf202bb1a0edad582dbaefe72aac1632e219fbd 100644 (file)
@@ -125,7 +125,7 @@ struct Qdisc {
        spinlock_t              seqlock;
 
        struct rcu_head         rcu;
-
+       netdevice_tracker       dev_tracker;
        /* private data */
        long privdata[] ____cacheline_aligned;
 };
index d33804d41c5c5a9047c808fd37ba65ae8875fc79..8c8fbf2e385679e46a1b7af47eeac059fb8468cc 100644 (file)
@@ -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);