diff options
author | David S. Miller <davem@davemloft.net> | 2013-10-28 00:11:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-28 00:11:22 -0400 |
commit | 1f2cd845d3827412e82bf26dde0abca332ede402 (patch) | |
tree | 370a0880f1fb5381925f8f602b2ba99f3904856f /drivers/net/bonding/bond_main.c | |
parent | 6384a4d0dcf9e28f5aa5e0c8a7e58e7b4df19e68 (diff) |
Revert "Merge branch 'bonding_monitor_locking'"
This reverts commit 4d961a101e032b4bf223b279b4b35bc77576f5a8, reversing
changes made to a00f6fcc7d0c62a91768d9c4ccba4c7d64fbbce3.
Revert bond locking changes, they cause regressions and Veaceslav Falico
doesn't like how the commit messages were done at all.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 100 |
1 files changed, 69 insertions, 31 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 535570ea8bbc..a141f406cb98 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2118,29 +2118,49 @@ void bond_mii_monitor(struct work_struct *work) | |||
2118 | struct bonding *bond = container_of(work, struct bonding, | 2118 | struct bonding *bond = container_of(work, struct bonding, |
2119 | mii_work.work); | 2119 | mii_work.work); |
2120 | bool should_notify_peers = false; | 2120 | bool should_notify_peers = false; |
2121 | unsigned long delay; | ||
2121 | 2122 | ||
2122 | if (!rtnl_trylock()) | 2123 | read_lock(&bond->lock); |
2123 | goto re_arm; | ||
2124 | 2124 | ||
2125 | if (!bond_has_slaves(bond)) { | 2125 | delay = msecs_to_jiffies(bond->params.miimon); |
2126 | rtnl_unlock(); | 2126 | |
2127 | if (!bond_has_slaves(bond)) | ||
2127 | goto re_arm; | 2128 | goto re_arm; |
2128 | } | ||
2129 | 2129 | ||
2130 | should_notify_peers = bond_should_notify_peers(bond); | 2130 | should_notify_peers = bond_should_notify_peers(bond); |
2131 | 2131 | ||
2132 | if (bond_miimon_inspect(bond)) | 2132 | if (bond_miimon_inspect(bond)) { |
2133 | bond_miimon_commit(bond); | 2133 | read_unlock(&bond->lock); |
2134 | 2134 | ||
2135 | if (should_notify_peers) | 2135 | /* Race avoidance with bond_close cancel of workqueue */ |
2136 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); | 2136 | if (!rtnl_trylock()) { |
2137 | read_lock(&bond->lock); | ||
2138 | delay = 1; | ||
2139 | should_notify_peers = false; | ||
2140 | goto re_arm; | ||
2141 | } | ||
2137 | 2142 | ||
2138 | rtnl_unlock(); | 2143 | read_lock(&bond->lock); |
2144 | |||
2145 | bond_miimon_commit(bond); | ||
2146 | |||
2147 | read_unlock(&bond->lock); | ||
2148 | rtnl_unlock(); /* might sleep, hold no other locks */ | ||
2149 | read_lock(&bond->lock); | ||
2150 | } | ||
2139 | 2151 | ||
2140 | re_arm: | 2152 | re_arm: |
2141 | if (bond->params.miimon) | 2153 | if (bond->params.miimon) |
2142 | queue_delayed_work(bond->wq, &bond->mii_work, | 2154 | queue_delayed_work(bond->wq, &bond->mii_work, delay); |
2143 | msecs_to_jiffies(bond->params.miimon)); | 2155 | |
2156 | read_unlock(&bond->lock); | ||
2157 | |||
2158 | if (should_notify_peers) { | ||
2159 | if (!rtnl_trylock()) | ||
2160 | return; | ||
2161 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); | ||
2162 | rtnl_unlock(); | ||
2163 | } | ||
2144 | } | 2164 | } |
2145 | 2165 | ||
2146 | static bool bond_has_this_ip(struct bonding *bond, __be32 ip) | 2166 | static bool bond_has_this_ip(struct bonding *bond, __be32 ip) |
@@ -2396,13 +2416,10 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2396 | struct list_head *iter; | 2416 | struct list_head *iter; |
2397 | int do_failover = 0; | 2417 | int do_failover = 0; |
2398 | 2418 | ||
2399 | if (!rtnl_trylock()) | 2419 | read_lock(&bond->lock); |
2400 | goto re_arm; | ||
2401 | 2420 | ||
2402 | if (!bond_has_slaves(bond)) { | 2421 | if (!bond_has_slaves(bond)) |
2403 | rtnl_unlock(); | ||
2404 | goto re_arm; | 2422 | goto re_arm; |
2405 | } | ||
2406 | 2423 | ||
2407 | oldcurrent = bond->curr_active_slave; | 2424 | oldcurrent = bond->curr_active_slave; |
2408 | /* see if any of the previous devices are up now (i.e. they have | 2425 | /* see if any of the previous devices are up now (i.e. they have |
@@ -2484,12 +2501,13 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2484 | write_unlock_bh(&bond->curr_slave_lock); | 2501 | write_unlock_bh(&bond->curr_slave_lock); |
2485 | unblock_netpoll_tx(); | 2502 | unblock_netpoll_tx(); |
2486 | } | 2503 | } |
2487 | rtnl_unlock(); | ||
2488 | 2504 | ||
2489 | re_arm: | 2505 | re_arm: |
2490 | if (bond->params.arp_interval) | 2506 | if (bond->params.arp_interval) |
2491 | queue_delayed_work(bond->wq, &bond->arp_work, | 2507 | queue_delayed_work(bond->wq, &bond->arp_work, |
2492 | msecs_to_jiffies(bond->params.arp_interval)); | 2508 | msecs_to_jiffies(bond->params.arp_interval)); |
2509 | |||
2510 | read_unlock(&bond->lock); | ||
2493 | } | 2511 | } |
2494 | 2512 | ||
2495 | /* | 2513 | /* |
@@ -2726,31 +2744,51 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2726 | struct bonding *bond = container_of(work, struct bonding, | 2744 | struct bonding *bond = container_of(work, struct bonding, |
2727 | arp_work.work); | 2745 | arp_work.work); |
2728 | bool should_notify_peers = false; | 2746 | bool should_notify_peers = false; |
2747 | int delta_in_ticks; | ||
2729 | 2748 | ||
2730 | if (!rtnl_trylock()) | 2749 | read_lock(&bond->lock); |
2731 | goto re_arm; | ||
2732 | 2750 | ||
2733 | if (!bond_has_slaves(bond)) { | 2751 | delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); |
2734 | rtnl_unlock(); | 2752 | |
2753 | if (!bond_has_slaves(bond)) | ||
2735 | goto re_arm; | 2754 | goto re_arm; |
2736 | } | ||
2737 | 2755 | ||
2738 | should_notify_peers = bond_should_notify_peers(bond); | 2756 | should_notify_peers = bond_should_notify_peers(bond); |
2739 | 2757 | ||
2740 | if (bond_ab_arp_inspect(bond)) | 2758 | if (bond_ab_arp_inspect(bond)) { |
2741 | bond_ab_arp_commit(bond); | 2759 | read_unlock(&bond->lock); |
2742 | 2760 | ||
2743 | bond_ab_arp_probe(bond); | 2761 | /* Race avoidance with bond_close flush of workqueue */ |
2762 | if (!rtnl_trylock()) { | ||
2763 | read_lock(&bond->lock); | ||
2764 | delta_in_ticks = 1; | ||
2765 | should_notify_peers = false; | ||
2766 | goto re_arm; | ||
2767 | } | ||
2744 | 2768 | ||
2745 | if (should_notify_peers) | 2769 | read_lock(&bond->lock); |
2746 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); | ||
2747 | 2770 | ||
2748 | rtnl_unlock(); | 2771 | bond_ab_arp_commit(bond); |
2772 | |||
2773 | read_unlock(&bond->lock); | ||
2774 | rtnl_unlock(); | ||
2775 | read_lock(&bond->lock); | ||
2776 | } | ||
2777 | |||
2778 | bond_ab_arp_probe(bond); | ||
2749 | 2779 | ||
2750 | re_arm: | 2780 | re_arm: |
2751 | if (bond->params.arp_interval) | 2781 | if (bond->params.arp_interval) |
2752 | queue_delayed_work(bond->wq, &bond->arp_work, | 2782 | queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); |
2753 | msecs_to_jiffies(bond->params.arp_interval)); | 2783 | |
2784 | read_unlock(&bond->lock); | ||
2785 | |||
2786 | if (should_notify_peers) { | ||
2787 | if (!rtnl_trylock()) | ||
2788 | return; | ||
2789 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); | ||
2790 | rtnl_unlock(); | ||
2791 | } | ||
2754 | } | 2792 | } |
2755 | 2793 | ||
2756 | /*-------------------------- netdev event handling --------------------------*/ | 2794 | /*-------------------------- netdev event handling --------------------------*/ |