All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nicolas de Pesloüan" <nicolas.2p.debian@free.fr>
To: Jiri Pirko <jpirko@redhat.com>
Cc: netdev@vger.kernel.org, fubar@us.ibm.com, davem@davemloft.net,
	bonding-devel@lists.sourceforge.net
Subject: Re: [Bonding-devel] [PATCH net-next-2.6] bonding: set primary param via	sysfs
Date: Fri, 18 Sep 2009 22:21:21 +0200	[thread overview]
Message-ID: <4AB3EBC1.6070100@free.fr> (raw)
In-Reply-To: <20090918121321.GB2801@psychotron.redhat.com>

Jiri Pirko wrote:
> Primary module parameter passed to bonding is pernament. That means if you

typo in "permanent".

> 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.

You patch also has the side effect of fixing this strange behavior:

If you move the primary slave from one bond device to another one, it becomes 
the primary for this other bond device, ignoring what you might have set as the 
primary for this other bond device.

#modprobe bonding mode=active-backup primary=eth0
#echo +eth0 > /sys/class/net/bond0/bonding/slaves
#cat /sys/class/net/bond0/bonding/primary
eth0
#echo -eth0 > /sys/class/net/bond0/bonding/slaves

#echo +eth1 > /sys/class/net/bond1/bonding/slaves
#echo eth1 > /sys/class/net/bond1/bonding/primary
#cat /sys/class/net/bond1/bonding/primary
eth1
#echo +eth0 > /sys/class/net/bond1/bonding/slaves
#cat /sys/class/net/bond1/bonding/primary
eth0

=> Primary just changed, for no good reason.

Can someone imagine that some current configurations rely on this incredible 
side effect ?

	Nicolas.

> 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 6044e12..ff449de 100644
> --- a/drivers/net/bonding/bond_sysfs.c
> +++ b/drivers/net/bonding/bond_sysfs.c
> @@ -1182,6 +1182,7 @@ static ssize_t bonding_store_primary(struct device *d,
>  				       ": %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;
>  			}


  reply	other threads:[~2009-09-18 20:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-18 12:13 [PATCH net-next-2.6] bonding: set primary param via sysfs Jiri Pirko
2009-09-18 20:21 ` Nicolas de Pesloüan [this message]
2009-09-18 23:02 ` Jay Vosburgh
2009-10-01 21:39 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AB3EBC1.6070100@free.fr \
    --to=nicolas.2p.debian@free.fr \
    --cc=bonding-devel@lists.sourceforge.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=jpirko@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.