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.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d5415ba9bdb0..5ac9718c5988 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -600,6 +600,7 @@ LIST_HEAD(bond_dev_list);
600static struct proc_dir_entry *bond_proc_dir = NULL; 600static struct proc_dir_entry *bond_proc_dir = NULL;
601#endif 601#endif
602 602
603extern struct rw_semaphore bonding_rwsem;
603static u32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; 604static u32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ;
604static int arp_ip_count = 0; 605static int arp_ip_count = 0;
605static int bond_mode = BOND_MODE_ROUNDROBIN; 606static int bond_mode = BOND_MODE_ROUNDROBIN;
@@ -1960,6 +1961,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1960 1961
1961 write_unlock_bh(&bond->lock); 1962 write_unlock_bh(&bond->lock);
1962 1963
1964 res = bond_create_slave_symlinks(bond_dev, slave_dev);
1965 if (res)
1966 goto err_unset_master;
1967
1963 printk(KERN_INFO DRV_NAME 1968 printk(KERN_INFO DRV_NAME
1964 ": %s: enslaving %s as a%s interface with a%s link.\n", 1969 ": %s: enslaving %s as a%s interface with a%s link.\n",
1965 bond_dev->name, slave_dev->name, 1970 bond_dev->name, slave_dev->name,
@@ -2133,6 +2138,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
2133 2138
2134 write_unlock_bh(&bond->lock); 2139 write_unlock_bh(&bond->lock);
2135 2140
2141 /* must do this from outside any spinlocks */
2142 bond_destroy_slave_symlinks(bond_dev, slave_dev);
2143
2136 bond_del_vlans_from_slave(bond, slave_dev); 2144 bond_del_vlans_from_slave(bond, slave_dev);
2137 2145
2138 /* If the mode USES_PRIMARY, then we should only remove its 2146 /* If the mode USES_PRIMARY, then we should only remove its
@@ -2224,6 +2232,7 @@ static int bond_release_all(struct net_device *bond_dev)
2224 */ 2232 */
2225 write_unlock_bh(&bond->lock); 2233 write_unlock_bh(&bond->lock);
2226 2234
2235 bond_destroy_slave_symlinks(bond_dev, slave_dev);
2227 bond_del_vlans_from_slave(bond, slave_dev); 2236 bond_del_vlans_from_slave(bond, slave_dev);
2228 2237
2229 /* If the mode USES_PRIMARY, then we should only remove its 2238 /* If the mode USES_PRIMARY, then we should only remove its
@@ -3518,7 +3527,10 @@ static int bond_event_changename(struct bonding *bond)
3518 bond_remove_proc_entry(bond); 3527 bond_remove_proc_entry(bond);
3519 bond_create_proc_entry(bond); 3528 bond_create_proc_entry(bond);
3520#endif 3529#endif
3521 3530 down_write(&(bonding_rwsem));
3531 bond_destroy_sysfs_entry(bond);
3532 bond_create_sysfs_entry(bond);
3533 up_write(&(bonding_rwsem));
3522 return NOTIFY_DONE; 3534 return NOTIFY_DONE;
3523} 3535}
3524 3536
@@ -3995,6 +4007,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
3995 return -EPERM; 4007 return -EPERM;
3996 } 4008 }
3997 4009
4010 down_write(&(bonding_rwsem));
3998 slave_dev = dev_get_by_name(ifr->ifr_slave); 4011 slave_dev = dev_get_by_name(ifr->ifr_slave);
3999 4012
4000 dprintk("slave_dev=%p: \n", slave_dev); 4013 dprintk("slave_dev=%p: \n", slave_dev);
@@ -4027,6 +4040,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
4027 dev_put(slave_dev); 4040 dev_put(slave_dev);
4028 } 4041 }
4029 4042
4043 up_write(&(bonding_rwsem));
4030 return res; 4044 return res;
4031} 4045}
4032 4046
@@ -4962,6 +4976,7 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
4962 *newbond = bond_dev->priv; 4976 *newbond = bond_dev->priv;
4963 4977
4964 rtnl_unlock(); /* allows sysfs registration of net device */ 4978 rtnl_unlock(); /* allows sysfs registration of net device */
4979 res = bond_create_sysfs_entry(bond_dev->priv);
4965 goto done; 4980 goto done;
4966out_bond: 4981out_bond:
4967 bond_deinit(bond_dev); 4982 bond_deinit(bond_dev);
@@ -4996,6 +5011,10 @@ static int __init bonding_init(void)
4996 goto err; 5011 goto err;
4997 } 5012 }
4998 5013
5014 res = bond_create_sysfs();
5015 if (res)
5016 goto err;
5017
4999 register_netdevice_notifier(&bond_netdev_notifier); 5018 register_netdevice_notifier(&bond_netdev_notifier);
5000 register_inetaddr_notifier(&bond_inetaddr_notifier); 5019 register_inetaddr_notifier(&bond_inetaddr_notifier);
5001 5020
@@ -5003,6 +5022,7 @@ static int __init bonding_init(void)
5003err: 5022err:
5004 rtnl_lock(); 5023 rtnl_lock();
5005 bond_free_all(); 5024 bond_free_all();
5025 bond_destroy_sysfs();
5006 rtnl_unlock(); 5026 rtnl_unlock();
5007out: 5027out:
5008 return res; 5028 return res;
@@ -5016,6 +5036,7 @@ static void __exit bonding_exit(void)
5016 5036
5017 rtnl_lock(); 5037 rtnl_lock();
5018 bond_free_all(); 5038 bond_free_all();
5039 bond_destroy_sysfs();
5019 rtnl_unlock(); 5040 rtnl_unlock();
5020} 5041}
5021 5042