diff options
author | Eric W. Biederman <ebiederm@aristanetworks.com> | 2009-10-29 10:18:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-30 15:41:20 -0400 |
commit | c67dfb299e05a132154b9bfaae4a83de478ffaa9 (patch) | |
tree | c50365a663033432ac9d5af2f0e70cc578eec474 /drivers/net/bonding | |
parent | 30c15ba9936a17d743f90eb3e2f6fa82acddc5f3 (diff) |
bond: Simplify bond device destruction
Manually inline the code from bond_deinit to bond_uninit. bond_uninit
is the only caller and it is short.
Move the call of bond_release_all from the netdev notifier into
bond_uninit. The call site is effectively the same and performing
the call explicitly allows all the paths for destroying a
bonding device to behave the same way.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 17c9580068b2..db9640b43d01 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -227,7 +227,7 @@ struct bond_parm_tbl ad_select_tbl[] = { | |||
227 | 227 | ||
228 | static void bond_send_gratuitous_arp(struct bonding *bond); | 228 | static void bond_send_gratuitous_arp(struct bonding *bond); |
229 | static int bond_init(struct net_device *bond_dev); | 229 | static int bond_init(struct net_device *bond_dev); |
230 | static void bond_deinit(struct net_device *bond_dev); | 230 | static void bond_uninit(struct net_device *bond_dev); |
231 | 231 | ||
232 | /*---------------------------- General routines -----------------------------*/ | 232 | /*---------------------------- General routines -----------------------------*/ |
233 | 233 | ||
@@ -2003,24 +2003,6 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
2003 | } | 2003 | } |
2004 | 2004 | ||
2005 | /* | 2005 | /* |
2006 | * Destroy a bonding device. | ||
2007 | * Must be under rtnl_lock when this function is called. | ||
2008 | */ | ||
2009 | static void bond_uninit(struct net_device *bond_dev) | ||
2010 | { | ||
2011 | struct bonding *bond = netdev_priv(bond_dev); | ||
2012 | |||
2013 | bond_deinit(bond_dev); | ||
2014 | |||
2015 | if (bond->wq) | ||
2016 | destroy_workqueue(bond->wq); | ||
2017 | |||
2018 | netif_addr_lock_bh(bond_dev); | ||
2019 | bond_mc_list_destroy(bond); | ||
2020 | netif_addr_unlock_bh(bond_dev); | ||
2021 | } | ||
2022 | |||
2023 | /* | ||
2024 | * First release a slave and than destroy the bond if no more slaves are left. | 2006 | * First release a slave and than destroy the bond if no more slaves are left. |
2025 | * Must be under rtnl_lock when this function is called. | 2007 | * Must be under rtnl_lock when this function is called. |
2026 | */ | 2008 | */ |
@@ -3467,9 +3449,6 @@ static int bond_master_netdev_event(unsigned long event, | |||
3467 | switch (event) { | 3449 | switch (event) { |
3468 | case NETDEV_CHANGENAME: | 3450 | case NETDEV_CHANGENAME: |
3469 | return bond_event_changename(event_bond); | 3451 | return bond_event_changename(event_bond); |
3470 | case NETDEV_UNREGISTER: | ||
3471 | bond_release_all(event_bond->dev); | ||
3472 | break; | ||
3473 | default: | 3452 | default: |
3474 | break; | 3453 | break; |
3475 | } | 3454 | } |
@@ -4608,18 +4587,29 @@ static void bond_work_cancel_all(struct bonding *bond) | |||
4608 | cancel_delayed_work(&bond->ad_work); | 4587 | cancel_delayed_work(&bond->ad_work); |
4609 | } | 4588 | } |
4610 | 4589 | ||
4611 | /* De-initialize device specific data. | 4590 | /* |
4612 | * Caller must hold rtnl_lock. | 4591 | * Destroy a bonding device. |
4613 | */ | 4592 | * Must be under rtnl_lock when this function is called. |
4614 | static void bond_deinit(struct net_device *bond_dev) | 4593 | */ |
4594 | static void bond_uninit(struct net_device *bond_dev) | ||
4615 | { | 4595 | { |
4616 | struct bonding *bond = netdev_priv(bond_dev); | 4596 | struct bonding *bond = netdev_priv(bond_dev); |
4617 | 4597 | ||
4598 | /* Release the bonded slaves */ | ||
4599 | bond_release_all(bond_dev); | ||
4600 | |||
4618 | list_del(&bond->bond_list); | 4601 | list_del(&bond->bond_list); |
4619 | 4602 | ||
4620 | bond_work_cancel_all(bond); | 4603 | bond_work_cancel_all(bond); |
4621 | 4604 | ||
4622 | bond_remove_proc_entry(bond); | 4605 | bond_remove_proc_entry(bond); |
4606 | |||
4607 | if (bond->wq) | ||
4608 | destroy_workqueue(bond->wq); | ||
4609 | |||
4610 | netif_addr_lock_bh(bond_dev); | ||
4611 | bond_mc_list_destroy(bond); | ||
4612 | netif_addr_unlock_bh(bond_dev); | ||
4623 | } | 4613 | } |
4624 | 4614 | ||
4625 | /* Unregister and free all bond devices. | 4615 | /* Unregister and free all bond devices. |
@@ -4632,9 +4622,6 @@ static void bond_free_all(void) | |||
4632 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { | 4622 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { |
4633 | struct net_device *bond_dev = bond->dev; | 4623 | struct net_device *bond_dev = bond->dev; |
4634 | 4624 | ||
4635 | bond_work_cancel_all(bond); | ||
4636 | /* Release the bonded slaves */ | ||
4637 | bond_release_all(bond_dev); | ||
4638 | unregister_netdevice(bond_dev); | 4625 | unregister_netdevice(bond_dev); |
4639 | } | 4626 | } |
4640 | 4627 | ||