aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/team
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2011-11-16 06:09:08 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-16 18:16:37 -0500
commit61dc3461b9549bc10a2f16d254250680cadafcce (patch)
tree9072edbb001647be7731ddb192355b59bdb82315 /drivers/net/team
parent8c0713a57482ebfadef197c856a38af3a55444c6 (diff)
team: convert overall spinlock to mutex
No need to have spinlock for this purpose. So convert this to mutex and avoid current schedule while atomic problems in netlink code. Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/team')
-rw-r--r--drivers/net/team/team.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index e5390c73a75..7db219cd315 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -443,9 +443,9 @@ static void __team_compute_features(struct team *team)
443 443
444static void team_compute_features(struct team *team) 444static void team_compute_features(struct team *team)
445{ 445{
446 spin_lock(&team->lock); 446 mutex_lock(&team->lock);
447 __team_compute_features(team); 447 __team_compute_features(team);
448 spin_unlock(&team->lock); 448 mutex_unlock(&team->lock);
449} 449}
450 450
451static int team_port_enter(struct team *team, struct team_port *port) 451static int team_port_enter(struct team *team, struct team_port *port)
@@ -647,7 +647,7 @@ static int team_init(struct net_device *dev)
647 int i; 647 int i;
648 648
649 team->dev = dev; 649 team->dev = dev;
650 spin_lock_init(&team->lock); 650 mutex_init(&team->lock);
651 651
652 team->pcpu_stats = alloc_percpu(struct team_pcpu_stats); 652 team->pcpu_stats = alloc_percpu(struct team_pcpu_stats);
653 if (!team->pcpu_stats) 653 if (!team->pcpu_stats)
@@ -672,13 +672,13 @@ static void team_uninit(struct net_device *dev)
672 struct team_port *port; 672 struct team_port *port;
673 struct team_port *tmp; 673 struct team_port *tmp;
674 674
675 spin_lock(&team->lock); 675 mutex_lock(&team->lock);
676 list_for_each_entry_safe(port, tmp, &team->port_list, list) 676 list_for_each_entry_safe(port, tmp, &team->port_list, list)
677 team_port_del(team, port->dev); 677 team_port_del(team, port->dev);
678 678
679 __team_change_mode(team, NULL); /* cleanup */ 679 __team_change_mode(team, NULL); /* cleanup */
680 __team_options_unregister(team, team_options, ARRAY_SIZE(team_options)); 680 __team_options_unregister(team, team_options, ARRAY_SIZE(team_options));
681 spin_unlock(&team->lock); 681 mutex_unlock(&team->lock);
682} 682}
683 683
684static void team_destructor(struct net_device *dev) 684static void team_destructor(struct net_device *dev)
@@ -784,7 +784,7 @@ static int team_change_mtu(struct net_device *dev, int new_mtu)
784 * Alhough this is reader, it's guarded by team lock. It's not possible 784 * Alhough this is reader, it's guarded by team lock. It's not possible
785 * to traverse list in reverse under rcu_read_lock 785 * to traverse list in reverse under rcu_read_lock
786 */ 786 */
787 spin_lock(&team->lock); 787 mutex_lock(&team->lock);
788 list_for_each_entry(port, &team->port_list, list) { 788 list_for_each_entry(port, &team->port_list, list) {
789 err = dev_set_mtu(port->dev, new_mtu); 789 err = dev_set_mtu(port->dev, new_mtu);
790 if (err) { 790 if (err) {
@@ -793,7 +793,7 @@ static int team_change_mtu(struct net_device *dev, int new_mtu)
793 goto unwind; 793 goto unwind;
794 } 794 }
795 } 795 }
796 spin_unlock(&team->lock); 796 mutex_unlock(&team->lock);
797 797
798 dev->mtu = new_mtu; 798 dev->mtu = new_mtu;
799 799
@@ -802,7 +802,7 @@ static int team_change_mtu(struct net_device *dev, int new_mtu)
802unwind: 802unwind:
803 list_for_each_entry_continue_reverse(port, &team->port_list, list) 803 list_for_each_entry_continue_reverse(port, &team->port_list, list)
804 dev_set_mtu(port->dev, dev->mtu); 804 dev_set_mtu(port->dev, dev->mtu);
805 spin_unlock(&team->lock); 805 mutex_unlock(&team->lock);
806 806
807 return err; 807 return err;
808} 808}
@@ -880,9 +880,9 @@ static int team_add_slave(struct net_device *dev, struct net_device *port_dev)
880 struct team *team = netdev_priv(dev); 880 struct team *team = netdev_priv(dev);
881 int err; 881 int err;
882 882
883 spin_lock(&team->lock); 883 mutex_lock(&team->lock);
884 err = team_port_add(team, port_dev); 884 err = team_port_add(team, port_dev);
885 spin_unlock(&team->lock); 885 mutex_unlock(&team->lock);
886 return err; 886 return err;
887} 887}
888 888
@@ -891,9 +891,9 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev)
891 struct team *team = netdev_priv(dev); 891 struct team *team = netdev_priv(dev);
892 int err; 892 int err;
893 893
894 spin_lock(&team->lock); 894 mutex_lock(&team->lock);
895 err = team_port_del(team, port_dev); 895 err = team_port_del(team, port_dev);
896 spin_unlock(&team->lock); 896 mutex_unlock(&team->lock);
897 return err; 897 return err;
898} 898}
899 899
@@ -1064,13 +1064,13 @@ static struct team *team_nl_team_get(struct genl_info *info)
1064 } 1064 }
1065 1065
1066 team = netdev_priv(dev); 1066 team = netdev_priv(dev);
1067 spin_lock(&team->lock); 1067 mutex_lock(&team->lock);
1068 return team; 1068 return team;
1069} 1069}
1070 1070
1071static void team_nl_team_put(struct team *team) 1071static void team_nl_team_put(struct team *team)
1072{ 1072{
1073 spin_unlock(&team->lock); 1073 mutex_unlock(&team->lock);
1074 dev_put(team->dev); 1074 dev_put(team->dev);
1075} 1075}
1076 1076
@@ -1486,9 +1486,9 @@ static void team_port_change_check(struct team_port *port, bool linkup)
1486{ 1486{
1487 struct team *team = port->team; 1487 struct team *team = port->team;
1488 1488
1489 spin_lock(&team->lock); 1489 mutex_lock(&team->lock);
1490 __team_port_change_check(port, linkup); 1490 __team_port_change_check(port, linkup);
1491 spin_unlock(&team->lock); 1491 mutex_unlock(&team->lock);
1492} 1492}
1493 1493
1494/************************************ 1494/************************************