aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 99ddd283e15e..23b832ffe7a9 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3489,10 +3489,10 @@ static int bond_event_changename(struct bonding *bond)
3489{ 3489{
3490 bond_remove_proc_entry(bond); 3490 bond_remove_proc_entry(bond);
3491 bond_create_proc_entry(bond); 3491 bond_create_proc_entry(bond);
3492 down_write(&(bonding_rwsem)); 3492
3493 bond_destroy_sysfs_entry(bond); 3493 bond_destroy_sysfs_entry(bond);
3494 bond_create_sysfs_entry(bond); 3494 bond_create_sysfs_entry(bond);
3495 up_write(&(bonding_rwsem)); 3495
3496 return NOTIFY_DONE; 3496 return NOTIFY_DONE;
3497} 3497}
3498 3498
@@ -4015,7 +4015,6 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
4015 return -EPERM; 4015 return -EPERM;
4016 } 4016 }
4017 4017
4018 down_write(&(bonding_rwsem));
4019 slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave); 4018 slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave);
4020 4019
4021 pr_debug("slave_dev=%p: \n", slave_dev); 4020 pr_debug("slave_dev=%p: \n", slave_dev);
@@ -4048,7 +4047,6 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
4048 dev_put(slave_dev); 4047 dev_put(slave_dev);
4049 } 4048 }
4050 4049
4051 up_write(&(bonding_rwsem));
4052 return res; 4050 return res;
4053} 4051}
4054 4052
@@ -5123,8 +5121,6 @@ int bond_create(const char *name)
5123 int res; 5121 int res;
5124 5122
5125 rtnl_lock(); 5123 rtnl_lock();
5126 down_write(&bonding_rwsem);
5127
5128 /* Check to see if the bond already exists. */ 5124 /* Check to see if the bond already exists. */
5129 if (name) { 5125 if (name) {
5130 list_for_each_entry(bond, &bond_dev_list, bond_list) 5126 list_for_each_entry(bond, &bond_dev_list, bond_list)
@@ -5173,24 +5169,20 @@ int bond_create(const char *name)
5173 goto out_bond; 5169 goto out_bond;
5174 } 5170 }
5175 5171
5176 up_write(&bonding_rwsem);
5177 rtnl_unlock(); /* allows sysfs registration of net device */
5178 res = bond_create_sysfs_entry(netdev_priv(bond_dev)); 5172 res = bond_create_sysfs_entry(netdev_priv(bond_dev));
5179 if (res < 0) 5173 if (res < 0)
5180 goto out_unreg; 5174 goto out_unreg;
5181 5175
5176 rtnl_unlock();
5182 return 0; 5177 return 0;
5183 5178
5184out_unreg: 5179out_unreg:
5185 rtnl_lock();
5186 down_write(&bonding_rwsem);
5187 unregister_netdevice(bond_dev); 5180 unregister_netdevice(bond_dev);
5188out_bond: 5181out_bond:
5189 bond_deinit(bond_dev); 5182 bond_deinit(bond_dev);
5190out_netdev: 5183out_netdev:
5191 free_netdev(bond_dev); 5184 free_netdev(bond_dev);
5192out_rtnl: 5185out_rtnl:
5193 up_write(&bonding_rwsem);
5194 rtnl_unlock(); 5186 rtnl_unlock();
5195 return res; 5187 return res;
5196} 5188}
@@ -5209,8 +5201,6 @@ static int __init bonding_init(void)
5209 5201
5210 bond_create_proc_dir(); 5202 bond_create_proc_dir();
5211 5203
5212 init_rwsem(&bonding_rwsem);
5213
5214 for (i = 0; i < max_bonds; i++) { 5204 for (i = 0; i < max_bonds; i++) {
5215 res = bond_create(NULL); 5205 res = bond_create(NULL);
5216 if (res) 5206 if (res)