Commit 0b688f24 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

net: add net device refcount tracker to struct netdev_queue

This will help debugging pesky netdev reference leaks.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 80e8921b
...@@ -586,6 +586,8 @@ struct netdev_queue { ...@@ -586,6 +586,8 @@ struct netdev_queue {
* read-mostly part * read-mostly part
*/ */
struct net_device *dev; struct net_device *dev;
netdevice_tracker dev_tracker;
struct Qdisc __rcu *qdisc; struct Qdisc __rcu *qdisc;
struct Qdisc *qdisc_sleeping; struct Qdisc *qdisc_sleeping;
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
......
...@@ -1607,7 +1607,7 @@ static void netdev_queue_release(struct kobject *kobj) ...@@ -1607,7 +1607,7 @@ static void netdev_queue_release(struct kobject *kobj)
struct netdev_queue *queue = to_netdev_queue(kobj); struct netdev_queue *queue = to_netdev_queue(kobj);
memset(kobj, 0, sizeof(*kobj)); memset(kobj, 0, sizeof(*kobj));
dev_put(queue->dev); dev_put_track(queue->dev, &queue->dev_tracker);
} }
static const void *netdev_queue_namespace(struct kobject *kobj) static const void *netdev_queue_namespace(struct kobject *kobj)
...@@ -1647,7 +1647,7 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index) ...@@ -1647,7 +1647,7 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index)
/* Kobject_put later will trigger netdev_queue_release call /* Kobject_put later will trigger netdev_queue_release call
* which decreases dev refcount: Take that reference here * which decreases dev refcount: Take that reference here
*/ */
dev_hold(queue->dev); dev_hold_track(queue->dev, &queue->dev_tracker, GFP_KERNEL);
kobj->kset = dev->queues_kset; kobj->kset = dev->queues_kset;
error = kobject_init_and_add(kobj, &netdev_queue_ktype, NULL, error = kobject_init_and_add(kobj, &netdev_queue_ktype, NULL,
......
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