Commit 095e200f authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

net: failover: add net device refcount tracker

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 63f13937
...@@ -25,6 +25,7 @@ struct failover_ops { ...@@ -25,6 +25,7 @@ struct failover_ops {
struct failover { struct failover {
struct list_head list; struct list_head list;
struct net_device __rcu *failover_dev; struct net_device __rcu *failover_dev;
netdevice_tracker dev_tracker;
struct failover_ops __rcu *ops; struct failover_ops __rcu *ops;
}; };
......
...@@ -252,7 +252,7 @@ struct failover *failover_register(struct net_device *dev, ...@@ -252,7 +252,7 @@ struct failover *failover_register(struct net_device *dev,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
rcu_assign_pointer(failover->ops, ops); rcu_assign_pointer(failover->ops, ops);
dev_hold(dev); dev_hold_track(dev, &failover->dev_tracker, GFP_KERNEL);
dev->priv_flags |= IFF_FAILOVER; dev->priv_flags |= IFF_FAILOVER;
rcu_assign_pointer(failover->failover_dev, dev); rcu_assign_pointer(failover->failover_dev, dev);
...@@ -285,7 +285,7 @@ void failover_unregister(struct failover *failover) ...@@ -285,7 +285,7 @@ void failover_unregister(struct failover *failover)
failover_dev->name); failover_dev->name);
failover_dev->priv_flags &= ~IFF_FAILOVER; failover_dev->priv_flags &= ~IFF_FAILOVER;
dev_put(failover_dev); dev_put_track(failover_dev, &failover->dev_tracker);
spin_lock(&failover_lock); spin_lock(&failover_lock);
list_del(&failover->list); list_del(&failover->list);
......
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