netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: davem@davemloft.net
Cc: vfalico@gmail.com, andy@greyhouse.net, netdev@vger.kernel.org,
	jay.vosburgh@canonical.com
Subject: [PATCH v2] bonding: ban stacked bonding support
Date: Fri, 20 Mar 2015 20:46:38 +0300	[thread overview]
Message-ID: <20150320174638.GA2053@p183.telecom.by> (raw)
In-Reply-To: <20150320174308.GA2005@p183.telecom.by>

If you add bonding master as a slave, and then release it,
it will no longer be an IFF_BONDING creating problems like described at
https://bugzilla.kernel.org/show_bug.cgi?id=89541

	echo +bond1 >/sys/class/net/bonding_masters
	echo 1 >/sys/class/net/bond1/bonding/mode
	echo +bond2 >/sys/class/net/bonding_masters
	echo +bond2 >/sys/class/net/bond1/bonding/slaves
	echo -bond2 >/sys/class/net/bond1/bonding/slaves
	echo -bond2 >/sys/class/net/bonding_masters

	cat /proc/net/bonding/bond2	# should not exist
		[oops]

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 drivers/net/bonding/bond_main.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1248,6 +1248,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 			    slave_dev->name);
 	}
 
+	if (netif_is_bond_master(slave_dev)) {
+		netdev_err(bond_dev, "device is bond master\n");
+		return -EBUSY;
+	}
+
 	/* already enslaved */
 	if (slave_dev->flags & IFF_SLAVE) {
 		netdev_dbg(bond_dev, "Error: Device was already enslaved\n");

  reply	other threads:[~2015-03-20 17:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20 22:20 [PATCH] bonding: ban stacked bonding support Alexey Dobriyan
2015-02-20 23:14 ` Jay Vosburgh
2015-02-21  2:55   ` Andy Gospodarek
2015-02-21 16:59   ` Jiri Pirko
2015-03-20 17:43   ` Alexey Dobriyan
2015-03-20 17:46     ` Alexey Dobriyan [this message]
2015-03-20 20:38       ` [PATCH v2] " David Miller
2015-03-20 21:02         ` Jay Vosburgh
2015-03-20 22:30           ` Jay Vosburgh

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=20150320174638.GA2053@p183.telecom.by \
    --to=adobriyan@gmail.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=jay.vosburgh@canonical.com \
    --cc=netdev@vger.kernel.org \
    --cc=vfalico@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).