diff options
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 11b76b352415..28a2d803e7e5 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1075,7 +1075,10 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1075 | struct slave *slave; | 1075 | struct slave *slave; |
1076 | struct bonding *bond = to_bond(d); | 1076 | struct bonding *bond = to_bond(d); |
1077 | 1077 | ||
1078 | write_lock_bh(&bond->lock); | 1078 | rtnl_lock(); |
1079 | read_lock(&bond->lock); | ||
1080 | write_lock_bh(&bond->curr_slave_lock); | ||
1081 | |||
1079 | if (!USES_PRIMARY(bond->params.mode)) { | 1082 | if (!USES_PRIMARY(bond->params.mode)) { |
1080 | printk(KERN_INFO DRV_NAME | 1083 | printk(KERN_INFO DRV_NAME |
1081 | ": %s: Unable to set primary slave; %s is in mode %d\n", | 1084 | ": %s: Unable to set primary slave; %s is in mode %d\n", |
@@ -1109,8 +1112,8 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1109 | } | 1112 | } |
1110 | } | 1113 | } |
1111 | out: | 1114 | out: |
1112 | write_unlock_bh(&bond->lock); | 1115 | write_unlock_bh(&bond->curr_slave_lock); |
1113 | 1116 | read_unlock(&bond->lock); | |
1114 | rtnl_unlock(); | 1117 | rtnl_unlock(); |
1115 | 1118 | ||
1116 | return count; | 1119 | return count; |
@@ -1190,7 +1193,8 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1190 | struct bonding *bond = to_bond(d); | 1193 | struct bonding *bond = to_bond(d); |
1191 | 1194 | ||
1192 | rtnl_lock(); | 1195 | rtnl_lock(); |
1193 | write_lock_bh(&bond->lock); | 1196 | read_lock(&bond->lock); |
1197 | write_lock_bh(&bond->curr_slave_lock); | ||
1194 | 1198 | ||
1195 | if (!USES_PRIMARY(bond->params.mode)) { | 1199 | if (!USES_PRIMARY(bond->params.mode)) { |
1196 | printk(KERN_INFO DRV_NAME | 1200 | printk(KERN_INFO DRV_NAME |
@@ -1247,7 +1251,8 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1247 | } | 1251 | } |
1248 | } | 1252 | } |
1249 | out: | 1253 | out: |
1250 | write_unlock_bh(&bond->lock); | 1254 | write_unlock_bh(&bond->curr_slave_lock); |
1255 | read_unlock(&bond->lock); | ||
1251 | rtnl_unlock(); | 1256 | rtnl_unlock(); |
1252 | 1257 | ||
1253 | return count; | 1258 | return count; |