Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2493

kernel-2.6.18-238.el5.src.rpm

From: Andy Gospodarek <gospo@redhat.com>
Date: Thu, 11 Nov 2010 18:54:21 -0500
Subject: [net] bonding: no lock on copy/clear VLAN list on slave
Message-id: <20101111185420.GA30673@gospo.rdu.redhat.com>
Patchwork-id: 29179
O-Subject: [PATCH RHEL5.6] bonding: don't lock when copying/clearing VLAN
	list on slave
Bugzilla: 627974
RH-Acked-by: Thomas Graf <tgraf@redhat.com>
RH-Acked-by: Amerigo Wang <amwang@redhat.com>
RH-Acked-by: David S. Miller <davem@redhat.com>
RH-Acked-by: Jiri Pirko <jpirko@redhat.com>

Unnecessary locking when removing some (at least tg3-based and
mlx4-based) devices was causing customers to hit a BUG halt since some
drivers would call schedule or might_sleep.  This lock is not needed at
rtnl is held already and slaves will not disappear out from under us.

The fix was a backport of the following upstream commit:

    commit 03dc2f4c525afb9488edb687c2e1f7057d59b40e
    Author: Jay Vosburgh <fubar@us.ibm.com>
    Date:   Wed Jul 21 12:14:48 2010 +0000

        bonding: don't lock when copying/clearing VLAN list on slave

Customer has reported this will resolve RHBZ 627974.

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5772942..9c3b0d0 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -563,10 +563,8 @@ static void bond_add_vlans_on_slave(struct bonding *bond, struct net_device *sla
 {
 	struct vlan_entry *vlan;
 
-	write_lock_bh(&bond->lock);
-
 	if (list_empty(&bond->vlan_list)) {
-		goto out;
+		return;
 	}
 
 	if ((slave_dev->features & NETIF_F_HW_VLAN_RX) &&
@@ -576,15 +574,12 @@ static void bond_add_vlans_on_slave(struct bonding *bond, struct net_device *sla
 
 	if (!(slave_dev->features & NETIF_F_HW_VLAN_FILTER) ||
 	    !(slave_dev->vlan_rx_add_vid)) {
-		goto out;
+		return;
 	}
 
 	list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
 		slave_dev->vlan_rx_add_vid(slave_dev, vlan->vlan_id);
 	}
-
-out:
-	write_unlock_bh(&bond->lock);
 }
 
 static void bond_del_vlans_from_slave(struct bonding *bond, struct net_device *slave_dev)
@@ -592,10 +587,8 @@ static void bond_del_vlans_from_slave(struct bonding *bond, struct net_device *s
 	struct vlan_entry *vlan;
 	struct net_device *vlan_dev;
 
-	write_lock_bh(&bond->lock);
-
 	if (list_empty(&bond->vlan_list)) {
-		goto out;
+		return;
 	}
 
 	if (!(slave_dev->features & NETIF_F_HW_VLAN_FILTER) ||
@@ -617,9 +610,6 @@ unreg:
 	    slave_dev->vlan_rx_register) {
 		slave_dev->vlan_rx_register(slave_dev, NULL);
 	}
-
-out:
-	write_unlock_bh(&bond->lock);
 }
 
 /*------------------------------- Link status -------------------------------*/