diff options
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 19d970e0cbb8..7a06ade85b02 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -229,7 +229,7 @@ static ssize_t bonding_show_slaves(struct device *d, | |||
229 | int i, res = 0; | 229 | int i, res = 0; |
230 | struct bonding *bond = to_bond(d); | 230 | struct bonding *bond = to_bond(d); |
231 | 231 | ||
232 | read_lock_bh(&bond->lock); | 232 | read_lock(&bond->lock); |
233 | bond_for_each_slave(bond, slave, i) { | 233 | bond_for_each_slave(bond, slave, i) { |
234 | if (res > (PAGE_SIZE - IFNAMSIZ)) { | 234 | if (res > (PAGE_SIZE - IFNAMSIZ)) { |
235 | /* not enough space for another interface name */ | 235 | /* not enough space for another interface name */ |
@@ -240,7 +240,7 @@ static ssize_t bonding_show_slaves(struct device *d, | |||
240 | } | 240 | } |
241 | res += sprintf(buf + res, "%s ", slave->dev->name); | 241 | res += sprintf(buf + res, "%s ", slave->dev->name); |
242 | } | 242 | } |
243 | read_unlock_bh(&bond->lock); | 243 | read_unlock(&bond->lock); |
244 | res += sprintf(buf + res, "\n"); | 244 | res += sprintf(buf + res, "\n"); |
245 | res++; | 245 | res++; |
246 | return res; | 246 | return res; |
@@ -282,18 +282,18 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
282 | 282 | ||
283 | /* Got a slave name in ifname. Is it already in the list? */ | 283 | /* Got a slave name in ifname. Is it already in the list? */ |
284 | found = 0; | 284 | found = 0; |
285 | read_lock_bh(&bond->lock); | 285 | read_lock(&bond->lock); |
286 | bond_for_each_slave(bond, slave, i) | 286 | bond_for_each_slave(bond, slave, i) |
287 | if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { | 287 | if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { |
288 | printk(KERN_ERR DRV_NAME | 288 | printk(KERN_ERR DRV_NAME |
289 | ": %s: Interface %s is already enslaved!\n", | 289 | ": %s: Interface %s is already enslaved!\n", |
290 | bond->dev->name, ifname); | 290 | bond->dev->name, ifname); |
291 | ret = -EPERM; | 291 | ret = -EPERM; |
292 | read_unlock_bh(&bond->lock); | 292 | read_unlock(&bond->lock); |
293 | goto out; | 293 | goto out; |
294 | } | 294 | } |
295 | 295 | ||
296 | read_unlock_bh(&bond->lock); | 296 | read_unlock(&bond->lock); |
297 | printk(KERN_INFO DRV_NAME ": %s: Adding slave %s.\n", | 297 | printk(KERN_INFO DRV_NAME ": %s: Adding slave %s.\n", |
298 | bond->dev->name, ifname); | 298 | bond->dev->name, ifname); |
299 | dev = dev_get_by_name(&init_net, ifname); | 299 | dev = dev_get_by_name(&init_net, ifname); |
@@ -1133,6 +1133,9 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1133 | } | 1133 | } |
1134 | out: | 1134 | out: |
1135 | write_unlock_bh(&bond->lock); | 1135 | write_unlock_bh(&bond->lock); |
1136 | |||
1137 | rtnl_unlock(); | ||
1138 | |||
1136 | return count; | 1139 | return count; |
1137 | } | 1140 | } |
1138 | static DEVICE_ATTR(primary, S_IRUGO | S_IWUSR, bonding_show_primary, bonding_store_primary); | 1141 | static DEVICE_ATTR(primary, S_IRUGO | S_IWUSR, bonding_show_primary, bonding_store_primary); |
@@ -1190,6 +1193,7 @@ static ssize_t bonding_show_active_slave(struct device *d, | |||
1190 | struct bonding *bond = to_bond(d); | 1193 | struct bonding *bond = to_bond(d); |
1191 | int count; | 1194 | int count; |
1192 | 1195 | ||
1196 | rtnl_lock(); | ||
1193 | 1197 | ||
1194 | read_lock(&bond->curr_slave_lock); | 1198 | read_lock(&bond->curr_slave_lock); |
1195 | curr = bond->curr_active_slave; | 1199 | curr = bond->curr_active_slave; |
@@ -1269,6 +1273,8 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1269 | } | 1273 | } |
1270 | out: | 1274 | out: |
1271 | write_unlock_bh(&bond->lock); | 1275 | write_unlock_bh(&bond->lock); |
1276 | rtnl_unlock(); | ||
1277 | |||
1272 | return count; | 1278 | return count; |
1273 | 1279 | ||
1274 | } | 1280 | } |