netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@redhat.com>
To: netdev@vger.kernel.org
Cc: fubar@us.ibm.com, andy@greyhouse.net, davem@davemloft.net
Subject: [PATCH net-next 3/3] bonding: unwind on bond_add_vlan add failure
Date: Mon,  5 Aug 2013 15:28:24 +0200	[thread overview]
Message-ID: <1375709304-16778-4-git-send-email-nikolay@redhat.com> (raw)
In-Reply-To: <1375709304-16778-1-git-send-email-nikolay@redhat.com>

From: Nikolay Aleksandrov <Nikolay Aleksandrov nikolay@redhat.com>

In case of bond_add_vlan() failure currently we'll have the vlan's
refcnt bumped up in all slaves, but it will never go down because it
failed to get added to the bond, so properly unwind the added vlan if
bond_add_vlan fails.

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
 drivers/net/bonding/bond_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ed1d261..0f9ca7e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -456,13 +456,13 @@ static int __bond_vlan_rx_add_vid(struct net_device *bond_dev,
 	if (res) {
 		pr_err("%s: Error: Failed to add vlan id %d\n",
 		       bond_dev->name, vid);
-		return res;
+		goto unwind;
 	}
 
 	return 0;
 
 unwind:
-	/* unwind from head to the slave that failed */
+	/* unwind from the slave that failed */
 	bond_for_each_slave_continue_reverse(bond, slave)
 		vlan_vid_del(slave->dev, proto, vid);
 
-- 
1.8.1.4

  parent reply	other threads:[~2013-08-05 13:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05 13:28 [PATCH net-next 0/3] bonding: vlan handling changes Nikolay Aleksandrov
2013-08-05 13:28 ` [PATCH net-next 1/3] bonding: fix vlan 0 addition and removal Nikolay Aleksandrov
2013-08-05 21:51   ` [net-next,1/3] " Veaceslav Falico
2013-08-05 23:08     ` David Miller
2013-08-06  0:37       ` Veaceslav Falico
2013-08-06  8:16     ` Nikolay Aleksandrov
2013-08-06  8:51       ` Veaceslav Falico
2013-08-06  9:01         ` Nikolay Aleksandrov
2013-08-06  8:39     ` Nikolay Aleksandrov
2013-08-06  8:59       ` Veaceslav Falico
2013-08-06  9:07         ` Nikolay Aleksandrov
2013-08-06  9:10           ` Veaceslav Falico
2013-08-05 13:28 ` [PATCH net-next 2/3] bonding: change the bond's vlan syncing functions with the standard ones Nikolay Aleksandrov
2013-08-05 21:56   ` [net-next, " Veaceslav Falico
2013-08-05 13:28 ` Nikolay Aleksandrov [this message]
2013-08-05 21:59   ` [net-next,3/3] bonding: unwind on bond_add_vlan add failure Veaceslav Falico
2013-08-05 23:09     ` 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=1375709304-16778-4-git-send-email-nikolay@redhat.com \
    --to=nikolay@redhat.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.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 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).