Skip to contentSkip to conversation

net/bonding: Don't destroy bonding master wehn unensalving with a sysfs command

PATCH In review Moni Shoua 1 participant 2 messages Jun 19, 2008 – Jun 25, 2008

Subsystems (3)
lore
Share & tools
lore

Moni Shoua

author
#0 lore raw

PATCH 1/1 net/bonding: Don't destroy bonding master wehn unensalving with a sysfs command

It is wrong to destroy a bonding master from a context that uses the sysfs of
that bond. When last IPoIB slave is unenslaved from by writing to a sysfs file (for bond0 this would be /sys/class/net/bond0/bonding/slaves) the driver tries to destroy the bond. This is wrong and can lead to a lockup or a crash. This fix lets the bonding master stay and relies on the user to destroy the bonding master if necessary (i.e. before module ib_ipoib is unloaded)

This patch affects only bonds of IPoIB slaves. Ethernet slaves stay unaffected.

---
 drivers/net/bonding/bond_sysfs.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/net/bonding/bond_sysfs.c +0 -3
index 08f3d39..f66f590 100644
@@ -351,9 +351,6 @@ static ssize_t bonding_store_slaves(struct device *d,
 		if (dev) {
 			printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n",
 				bond->dev->name, dev->name);
-			if (bond->setup_by_slave)
-				res = bond_release_and_destroy(bond->dev, dev);
-			else
 				res = bond_release(bond->dev, dev);
 			if (res) {
 				ret = res;
Signature · 1 line
1.5.5
author
#1 lore raw
Quoted 18 lines · Moni Shoua

It is wrong to destroy a bonding master from a context that uses the sysfs of
that bond. When last IPoIB slave is unenslaved from by writing to a sysfs file (for bond0 this would be /sys/class/net/bond0/bonding/slaves) the driver tries to destroy the bond. This is wrong and can lead to a lockup or a crash. This fix lets the bonding master stay and relies on the user to destroy the bonding master if necessary (i.e. before module ib_ipoib is unloaded)

This patch affects only bonds of IPoIB slaves. Ethernet slaves stay unaffected.

---
 drivers/net/bonding/bond_sysfs.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/net/bonding/bond_sysfs.c +0 -0
index 08f3d39..f66f590 100644

drivers/net/bonding/bond_sysfs.c static ssize_t bonding_store_slaves(struct device *d, · line 356

Quoted 9 lines
drivers/net/bonding/bond_sysfs.c +0 -3
@@ -351,9 +351,6 @@ static ssize_t bonding_store_slaves(struct device *d,
 		if (dev) {
 			printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n",
 				bond->dev->name, dev->name);
-			if (bond->setup_by_slave)
-				res = bond_release_and_destroy(bond->dev, dev);
-			else
 				res = bond_release(bond->dev, dev);
 			if (res) {
 				ret = res;

Hi Jay,
Could you please refer to this one?