diff options
Diffstat (limited to 'drivers/net/bonding')
| -rw-r--r-- | drivers/net/bonding/bond_main.c | 13 | ||||
| -rw-r--r-- | drivers/net/bonding/bond_procfs.c | 4 | ||||
| -rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 5 | 
3 files changed, 12 insertions, 10 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 11d01d67b3f..6bbd90e1123 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1629,7 +1629,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)  	/* If this is the first slave, then we need to set the master's hardware  	 * address to be the same as the slave's. */ -	if (bond->dev_addr_from_first) +	if (bond->slave_cnt == 0 && bond->dev_addr_from_first)  		bond_set_dev_addr(bond->dev, slave_dev);  	new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL); @@ -1746,6 +1746,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)  	bond_compute_features(bond); +	bond_update_speed_duplex(new_slave); +  	read_lock(&bond->lock);  	new_slave->last_arp_rx = jiffies - @@ -1798,8 +1800,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)  		new_slave->link == BOND_LINK_DOWN ? "DOWN" :  			(new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); -	bond_update_speed_duplex(new_slave); -  	if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) {  		/* if there is a primary slave, remember it */  		if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { @@ -1964,7 +1964,6 @@ static int __bond_release_one(struct net_device *bond_dev,  	}  	block_netpoll_tx(); -	call_netdevice_notifiers(NETDEV_RELEASE, bond_dev);  	write_lock_bh(&bond->lock);  	slave = bond_get_slave_by_dev(bond, slave_dev); @@ -2066,8 +2065,10 @@ static int __bond_release_one(struct net_device *bond_dev,  	write_unlock_bh(&bond->lock);  	unblock_netpoll_tx(); -	if (bond->slave_cnt == 0) +	if (bond->slave_cnt == 0) {  		call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); +		call_netdevice_notifiers(NETDEV_RELEASE, bond->dev); +	}  	bond_compute_features(bond);  	if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && @@ -2373,8 +2374,6 @@ static void bond_miimon_commit(struct bonding *bond)  				bond_set_backup_slave(slave);  			} -			bond_update_speed_duplex(slave); -  			pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n",  				bond->dev->name, slave->dev->name,  				slave->speed, slave->duplex ? "full" : "half"); diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 3cea38d3734..94d06f1307b 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c @@ -218,15 +218,13 @@ static const struct seq_operations bond_info_seq_ops = {  static int bond_info_open(struct inode *inode, struct file *file)  {  	struct seq_file *seq; -	struct proc_dir_entry *proc;  	int res;  	res = seq_open(file, &bond_info_seq_ops);  	if (!res) {  		/* recover the pointer buried in proc_dir_entry data */  		seq = file->private_data; -		proc = PDE(inode); -		seq->private = proc->data; +		seq->private = PDE_DATA(inode);  	}  	return res; diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 1c9e09fbdff..db103e03ba0 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -183,6 +183,11 @@ int bond_create_slave_symlinks(struct net_device *master,  	sprintf(linkname, "slave_%s", slave->name);  	ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj),  				linkname); + +	/* free the master link created earlier in case of error */ +	if (ret) +		sysfs_remove_link(&(slave->dev.kobj), "master"); +  	return ret;  }  |