mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
net: failover: add net device refcount tracker
Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
63f13937cb
commit
095e200f17
@ -25,6 +25,7 @@ struct failover_ops {
|
||||
struct failover {
|
||||
struct list_head list;
|
||||
struct net_device __rcu *failover_dev;
|
||||
netdevice_tracker dev_tracker;
|
||||
struct failover_ops __rcu *ops;
|
||||
};
|
||||
|
||||
|
@ -252,7 +252,7 @@ struct failover *failover_register(struct net_device *dev,
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
rcu_assign_pointer(failover->ops, ops);
|
||||
dev_hold(dev);
|
||||
dev_hold_track(dev, &failover->dev_tracker, GFP_KERNEL);
|
||||
dev->priv_flags |= IFF_FAILOVER;
|
||||
rcu_assign_pointer(failover->failover_dev, dev);
|
||||
|
||||
@ -285,7 +285,7 @@ void failover_unregister(struct failover *failover)
|
||||
failover_dev->name);
|
||||
|
||||
failover_dev->priv_flags &= ~IFF_FAILOVER;
|
||||
dev_put(failover_dev);
|
||||
dev_put_track(failover_dev, &failover->dev_tracker);
|
||||
|
||||
spin_lock(&failover_lock);
|
||||
list_del(&failover->list);
|
||||
|
Loading…
Reference in New Issue
Block a user