Sophie

Sophie

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

kernel-2.6.18-238.el5.src.rpm

From: Jiri Pirko <jpirko@redhat.com>
Date: Fri, 2 Oct 2009 11:00:58 +0200
Subject: [net] bonding: set primary param via sysfs
Message-id: 20091002090057.GB2822@psychotron.redhat.com
O-Subject: [RHEL5.5 patch] BZ499884 net: bonding: set primary param via sysfs
Bugzilla: 499884
RH-Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
RH-Acked-by: Neil Horman <nhorman@redhat.com>
RH-Acked-by: David Miller <davem@redhat.com>

BZ499884
https://bugzilla.redhat.com/show_bug.cgi?id=499884

Description:
Primary module parameter passed to bonding is permanent. That means if you
release the primary slave and enslave it again, it becomes the primary slave
again. But if you set primary slave via sysfs, the primary slave is only set
once and it's not remembered in bond->params structure. Therefore the setting
is lost after releasing the primary slave. This simple one-liner fixes this.

Upstream:
http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commitdiff;h=ce501caf162a2b18c50b6915684217c3b9e16b46

Brew:
https://brewweb.devel.redhat.com/taskinfo?taskID=1991886

Test:
Tested on x86_64, i686.

Jirka

Signed-off-by: Jiri Pirko <jpirko@redhat.com>

diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index a39b61d..3958e07 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1114,6 +1114,7 @@ static ssize_t bonding_store_primary(struct class_device *cd, const char *buf, s
 				       ": %s: Setting %s as primary slave.\n",
 				       bond->dev->name, slave->dev->name);
 				bond->primary_slave = slave;
+				strcpy(bond->params.primary, slave->dev->name);
 				bond_select_active_slave(bond);
 				goto out;
 			}