diff options
Diffstat (limited to 'drivers/net/bonding/bond_alb.c')
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 25b8dbf6cfd7..b57bc9467dbe 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -979,7 +979,7 @@ static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct | |||
979 | /* | 979 | /* |
980 | * Send learning packets after MAC address swap. | 980 | * Send learning packets after MAC address swap. |
981 | * | 981 | * |
982 | * Called with RTNL and bond->lock held for read. | 982 | * Called with RTNL and no other locks |
983 | */ | 983 | */ |
984 | static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, | 984 | static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, |
985 | struct slave *slave2) | 985 | struct slave *slave2) |
@@ -987,6 +987,8 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, | |||
987 | int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2)); | 987 | int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2)); |
988 | struct slave *disabled_slave = NULL; | 988 | struct slave *disabled_slave = NULL; |
989 | 989 | ||
990 | ASSERT_RTNL(); | ||
991 | |||
990 | /* fasten the change in the switch */ | 992 | /* fasten the change in the switch */ |
991 | if (SLAVE_IS_OK(slave1)) { | 993 | if (SLAVE_IS_OK(slave1)) { |
992 | alb_send_learning_packets(slave1, slave1->dev->dev_addr); | 994 | alb_send_learning_packets(slave1, slave1->dev->dev_addr); |
@@ -1031,7 +1033,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, | |||
1031 | * a slave that has @slave's permanet address as its current address. | 1033 | * a slave that has @slave's permanet address as its current address. |
1032 | * We'll make sure that that slave no longer uses @slave's permanent address. | 1034 | * We'll make sure that that slave no longer uses @slave's permanent address. |
1033 | * | 1035 | * |
1034 | * Caller must hold bond lock | 1036 | * Caller must hold RTNL and no other locks |
1035 | */ | 1037 | */ |
1036 | static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) | 1038 | static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) |
1037 | { | 1039 | { |
@@ -1542,7 +1544,12 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave) | |||
1542 | return 0; | 1544 | return 0; |
1543 | } | 1545 | } |
1544 | 1546 | ||
1545 | /* Caller must hold bond lock for write */ | 1547 | /* |
1548 | * Remove slave from tlb and rlb hash tables, and fix up MAC addresses | ||
1549 | * if necessary. | ||
1550 | * | ||
1551 | * Caller must hold RTNL and no other locks | ||
1552 | */ | ||
1546 | void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) | 1553 | void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) |
1547 | { | 1554 | { |
1548 | if (bond->slave_cnt > 1) { | 1555 | if (bond->slave_cnt > 1) { |
@@ -1601,9 +1608,6 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave | |||
1601 | struct slave *swap_slave; | 1608 | struct slave *swap_slave; |
1602 | int i; | 1609 | int i; |
1603 | 1610 | ||
1604 | if (new_slave) | ||
1605 | ASSERT_RTNL(); | ||
1606 | |||
1607 | if (bond->curr_active_slave == new_slave) { | 1611 | if (bond->curr_active_slave == new_slave) { |
1608 | return; | 1612 | return; |
1609 | } | 1613 | } |
@@ -1649,6 +1653,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave | |||
1649 | write_unlock_bh(&bond->curr_slave_lock); | 1653 | write_unlock_bh(&bond->curr_slave_lock); |
1650 | read_unlock(&bond->lock); | 1654 | read_unlock(&bond->lock); |
1651 | 1655 | ||
1656 | ASSERT_RTNL(); | ||
1657 | |||
1652 | /* curr_active_slave must be set before calling alb_swap_mac_addr */ | 1658 | /* curr_active_slave must be set before calling alb_swap_mac_addr */ |
1653 | if (swap_slave) { | 1659 | if (swap_slave) { |
1654 | /* swap mac address */ | 1660 | /* swap mac address */ |
@@ -1659,12 +1665,11 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave | |||
1659 | bond->alb_info.rlb_enabled); | 1665 | bond->alb_info.rlb_enabled); |
1660 | } | 1666 | } |
1661 | 1667 | ||
1662 | read_lock(&bond->lock); | ||
1663 | |||
1664 | if (swap_slave) { | 1668 | if (swap_slave) { |
1665 | alb_fasten_mac_swap(bond, swap_slave, new_slave); | 1669 | alb_fasten_mac_swap(bond, swap_slave, new_slave); |
1670 | read_lock(&bond->lock); | ||
1666 | } else { | 1671 | } else { |
1667 | /* fasten bond mac on new current slave */ | 1672 | read_lock(&bond->lock); |
1668 | alb_send_learning_packets(new_slave, bond->dev->dev_addr); | 1673 | alb_send_learning_packets(new_slave, bond->dev->dev_addr); |
1669 | } | 1674 | } |
1670 | 1675 | ||