aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorJay Vosburgh <fubar@us.ibm.com>2007-10-17 20:37:50 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-23 20:32:00 -0400
commit6603a6f25e4bca922a7dfbf0bf03072d98850176 (patch)
tree1e62ef0fe037036542def53dca162618a8345132 /drivers/net/bonding/bond_main.c
parent059fe7a578fba5bbb0fdc0365bfcf6218fa25eb0 (diff)
bonding: Convert more locks to _bh, acquire rtnl, for new locking
Convert more lock acquisitions to _bh flavor to avoid deadlock with workqueue activity and add acquisition of RTNL in appropriate places. Affects ALB mode, as well as core bonding functions and sysfs. Signed-off-by: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 15c1f7ad222b..6909becb10f6 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1846,9 +1846,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1846*/ 1846*/
1847void bond_destroy(struct bonding *bond) 1847void bond_destroy(struct bonding *bond)
1848{ 1848{
1849 unregister_netdevice(bond->dev);
1849 bond_deinit(bond->dev); 1850 bond_deinit(bond->dev);
1850 bond_destroy_sysfs_entry(bond); 1851 bond_destroy_sysfs_entry(bond);
1851 unregister_netdevice(bond->dev);
1852} 1852}
1853 1853
1854/* 1854/*
@@ -2057,9 +2057,9 @@ static int bond_info_query(struct net_device *bond_dev, struct ifbond *info)
2057 info->bond_mode = bond->params.mode; 2057 info->bond_mode = bond->params.mode;
2058 info->miimon = bond->params.miimon; 2058 info->miimon = bond->params.miimon;
2059 2059
2060 read_lock_bh(&bond->lock); 2060 read_lock(&bond->lock);
2061 info->num_slaves = bond->slave_cnt; 2061 info->num_slaves = bond->slave_cnt;
2062 read_unlock_bh(&bond->lock); 2062 read_unlock(&bond->lock);
2063 2063
2064 return 0; 2064 return 0;
2065} 2065}
@@ -2074,7 +2074,7 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
2074 return -ENODEV; 2074 return -ENODEV;
2075 } 2075 }
2076 2076
2077 read_lock_bh(&bond->lock); 2077 read_lock(&bond->lock);
2078 2078
2079 bond_for_each_slave(bond, slave, i) { 2079 bond_for_each_slave(bond, slave, i) {
2080 if (i == (int)info->slave_id) { 2080 if (i == (int)info->slave_id) {
@@ -2083,7 +2083,7 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
2083 } 2083 }
2084 } 2084 }
2085 2085
2086 read_unlock_bh(&bond->lock); 2086 read_unlock(&bond->lock);
2087 2087
2088 if (found) { 2088 if (found) {
2089 strcpy(info->slave_name, slave->dev->name); 2089 strcpy(info->slave_name, slave->dev->name);
@@ -3078,7 +3078,7 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
3078 3078
3079 /* make sure the bond won't be taken away */ 3079 /* make sure the bond won't be taken away */
3080 read_lock(&dev_base_lock); 3080 read_lock(&dev_base_lock);
3081 read_lock_bh(&bond->lock); 3081 read_lock(&bond->lock);
3082 3082
3083 if (*pos == 0) { 3083 if (*pos == 0) {
3084 return SEQ_START_TOKEN; 3084 return SEQ_START_TOKEN;
@@ -3112,7 +3112,7 @@ static void bond_info_seq_stop(struct seq_file *seq, void *v)
3112{ 3112{
3113 struct bonding *bond = seq->private; 3113 struct bonding *bond = seq->private;
3114 3114
3115 read_unlock_bh(&bond->lock); 3115 read_unlock(&bond->lock);
3116 read_unlock(&dev_base_lock); 3116 read_unlock(&dev_base_lock);
3117} 3117}
3118 3118
@@ -3821,13 +3821,13 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
3821 if (mii->reg_num == 1) { 3821 if (mii->reg_num == 1) {
3822 struct bonding *bond = bond_dev->priv; 3822 struct bonding *bond = bond_dev->priv;
3823 mii->val_out = 0; 3823 mii->val_out = 0;
3824 read_lock_bh(&bond->lock); 3824 read_lock(&bond->lock);
3825 read_lock(&bond->curr_slave_lock); 3825 read_lock(&bond->curr_slave_lock);
3826 if (netif_carrier_ok(bond->dev)) { 3826 if (netif_carrier_ok(bond->dev)) {
3827 mii->val_out = BMSR_LSTATUS; 3827 mii->val_out = BMSR_LSTATUS;
3828 } 3828 }
3829 read_unlock(&bond->curr_slave_lock); 3829 read_unlock(&bond->curr_slave_lock);
3830 read_unlock_bh(&bond->lock); 3830 read_unlock(&bond->lock);
3831 } 3831 }
3832 3832
3833 return 0; 3833 return 0;
@@ -4473,8 +4473,8 @@ static void bond_free_all(void)
4473 bond_mc_list_destroy(bond); 4473 bond_mc_list_destroy(bond);
4474 /* Release the bonded slaves */ 4474 /* Release the bonded slaves */
4475 bond_release_all(bond_dev); 4475 bond_release_all(bond_dev);
4476 bond_deinit(bond_dev);
4477 unregister_netdevice(bond_dev); 4476 unregister_netdevice(bond_dev);
4477 bond_deinit(bond_dev);
4478 } 4478 }
4479 4479
4480#ifdef CONFIG_PROC_FS 4480#ifdef CONFIG_PROC_FS