Skip to contentSkip to conversation

Build errors in v3.10-stable-queue

DISCUSSION Guenter Roeck 4 participants 4 messages Sep 26, 2015 – Oct 18, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

drivers/net/bonding/bond_main.c: In function ‘bond_get_old_active’:
drivers/net/bonding/bond_main.c:884:33: error: macro "bond_for_each_slave" requires 3 arguments, but only 2 given drivers/net/bonding/bond_main.c:884:2: error: ‘bond_for_each_slave’ undeclared (first use in this function) drivers/net/bonding/bond_main.c:884:2: note: each undeclared identifier is reported only once for each function it appears in drivers/net/bonding/bond_main.c:884:35: error: expected ‘;’ before ‘{’ token

This affects a large number of builds.

Culprit is 'bonding: correct the MAC address for "follow" fail_over_mac policy', which may need a backport.

Guenter

Tested-by Nikolay Aleksandrov
#1 lore raw
Quoted 10 lines · Guenter Roeck

drivers/net/bonding/bond_main.c: In function ‘bond_get_old_active’:
drivers/net/bonding/bond_main.c:884:33: error: macro "bond_for_each_slave" requires 3 arguments, but only 2 given drivers/net/bonding/bond_main.c:884:2: error: ‘bond_for_each_slave’ undeclared (first use in this function) drivers/net/bonding/bond_main.c:884:2: note: each undeclared identifier is reported only once for each function it appears in drivers/net/bonding/bond_main.c:884:35: error: expected ‘;’ before ‘{’ token

This affects a large number of builds.

Culprit is 'bonding: correct the MAC address for "follow" fail_over_mac policy', which may need a backport.

bond_for_each_slave() needs an int parameter for a counter.

Untested backport attached, based on what I did for 3.2.

Ben.

Signature · 2 lines
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

From: dingtianhong <[email protected]>
Date: Thu, 16 Jul 2015 16:30:02 +0800
Subject: bonding: correct the MAC address for "follow" fail_over_mac policy

[ Upstream commit a951bc1e6ba58f11df5ed5ddc41311e10f5fd20b ]

The "follow" fail_over_mac policy is useful for multiport devices that either become confused or incur a performance penalty when multiple ports are programmed with the same MAC address, but the same MAC address still may happened by this steps for this policy:

1) echo +eth0 > /sys/class/net/bond0/bonding/slaves bond0 has the same mac address with eth0, it is MAC1.

2) echo +eth1 > /sys/class/net/bond0/bonding/slaves eth1 is backup, eth1 has MAC2.

3) ifconfig eth0 down
eth1 became active slave, bond will swap MAC for eth0 and eth1, so eth1 has MAC1, and eth0 has MAC2.

4) ifconfig eth1 down
there is no active slave, and eth1 still has MAC1, eth2 has MAC2.

5) ifconfig eth0 up
the eth0 became active slave again, the bond set eth0 to MAC1.

Something wrong here, then if you set eth1 up, the eth0 and eth1 will have the same MAC address, it will break this policy for ACTIVE_BACKUP mode.

This patch will fix this problem by finding the old active slave and swap them MAC address before change active slave.

[bwh: Backported to 3.10: bond_for_each_slave() takes an extra int paramter]

---

drivers/net/bonding/bond_main.c +20 -0
@@ -861,6 +861,23 @@ static void bond_mc_swap(struct bonding
 	}
 }
 
+static struct slave *bond_get_old_active(struct bonding *bond,
+					 struct slave *new_active)
+{
+	struct slave *slave;
+	int i;
+
+	bond_for_each_slave(bond, slave, i) {
+		if (slave == new_active)
+			continue;
+
+		if (ether_addr_equal(bond->dev->dev_addr, slave->dev->dev_addr))
+			return slave;
+	}
+
+	return NULL;
+}
+
 /*
  * bond_do_fail_over_mac
  *
@@ -898,6 +915,9 @@ static void bond_do_fail_over_mac(struct
 		write_unlock_bh(&bond->curr_slave_lock);
 		read_unlock(&bond->lock);
 
+		if (!old_active)
+			old_active = bond_get_old_active(bond, new_active);
+
 		if (old_active) {
 			memcpy(tmp_mac, new_active->dev->dev_addr, ETH_ALEN);
 			memcpy(saddr.sa_data, old_active->dev->dev_addr,
#2 lore raw
Quoted 7 lines · Ben Hutchings
Quoted 6 lines · Guenter Roeck

drivers/net/bonding/bond_main.c: In function ???bond_get_old_active???:
drivers/net/bonding/bond_main.c:884:33: error: macro "bond_for_each_slave" requires 3 arguments, but only 2 given drivers/net/bonding/bond_main.c:884:2: error: ???bond_for_each_slave??? undeclared (first use in this function) drivers/net/bonding/bond_main.c:884:2: note: each undeclared identifier is reported only once for each function it appears in drivers/net/bonding/bond_main.c:884:35: error: expected ???;??? before ???{??? token

Quoted 8 lines
Quoted 4 lines

This affects a large number of builds.

Culprit is 'bonding: correct the MAC address for "follow" fail_over_mac policy', which may need a backport.

bond_for_each_slave() needs an int parameter for a counter.

Untested backport attached, based on what I did for 3.2.

I agree with the fix, it's similar to what I proposed (except that you actually did the patch of course).

Willy

#3 lore raw
In reply to Ben Hutchings
Quoted 7 lines · Ben Hutchings
Quoted 6 lines · Guenter Roeck

drivers/net/bonding/bond_main.c: In function ‘bond_get_old_active’:
drivers/net/bonding/bond_main.c:884:33: error: macro "bond_for_each_slave" requires 3 arguments, but only 2 given drivers/net/bonding/bond_main.c:884:2: error: ‘bond_for_each_slave’ undeclared (first use in this function) drivers/net/bonding/bond_main.c:884:2: note: each undeclared identifier is reported only once for each function it appears in drivers/net/bonding/bond_main.c:884:35: error: expected ‘;’ before ‘{’ token

Quoted 8 lines
Quoted 4 lines

This affects a large number of builds.

Culprit is 'bonding: correct the MAC address for "follow" fail_over_mac policy', which may need a backport.

bond_for_each_slave() needs an int parameter for a counter.

Untested backport attached, based on what I did for 3.2.

Thanks, now applied.

greg k-h