netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@redhat.com>
To: netdev@vger.kernel.org
Cc: vfalico@gmail.com, j.vosburgh@gmail.com, andy@greyhouse.net,
	davem@davemloft.net, Nikolay Aleksandrov <nikolay@redhat.com>
Subject: [PATCH net-next v2 1/7] bonding: 3ad: clean up curr_slave_lock usage
Date: Thu, 11 Sep 2014 22:49:22 +0200	[thread overview]
Message-ID: <1410468568-13781-2-git-send-email-nikolay@redhat.com> (raw)
In-Reply-To: <1410468568-13781-1-git-send-email-nikolay@redhat.com>

Remove the read_lock in bond_3ad_lacpdu_recv() since when the slave is
being released its rx_handler is removed before 3ad unbind, so even if
packets arrive, they won't see the slave in an inconsistent state.

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
---
v2: Only remove the curr_slave_lock from bond_3ad_lacpdu_recv, leave it in
    bond_3ad_state_machine_handler

 drivers/net/bonding/bond_3ad.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 5d27a6207384..dfd3a7835d17 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2476,20 +2476,16 @@ err_free:
 int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
 			 struct slave *slave)
 {
-	int ret = RX_HANDLER_ANOTHER;
 	struct lacpdu *lacpdu, _lacpdu;
 
 	if (skb->protocol != PKT_TYPE_LACPDU)
-		return ret;
+		return RX_HANDLER_ANOTHER;
 
 	lacpdu = skb_header_pointer(skb, 0, sizeof(_lacpdu), &_lacpdu);
 	if (!lacpdu)
-		return ret;
+		return RX_HANDLER_ANOTHER;
 
-	read_lock(&bond->curr_slave_lock);
-	ret = bond_3ad_rx_indication(lacpdu, slave, skb->len);
-	read_unlock(&bond->curr_slave_lock);
-	return ret;
+	return bond_3ad_rx_indication(lacpdu, slave, skb->len);
 }
 
 /**
-- 
1.9.3

  reply	other threads:[~2014-09-11 20:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 20:49 [PATCH net-next v2 0/7] bonding: get rid of curr_slave_lock Nikolay Aleksandrov
2014-09-11 20:49 ` Nikolay Aleksandrov [this message]
2014-09-11 20:49 ` [PATCH net-next v2 2/7] bonding: alb: remove curr_slave_lock Nikolay Aleksandrov
2014-09-11 20:49 ` [PATCH net-next v2 3/7] bonding: clean curr_slave_lock use Nikolay Aleksandrov
2014-09-11 20:49 ` [PATCH net-next v2 4/7] bonding: convert curr_slave_lock to a spinlock and rename it Nikolay Aleksandrov
2014-09-11 20:49 ` [PATCH net-next v2 5/7] bonding: alb: convert to bond->mode_lock Nikolay Aleksandrov
2014-09-11 20:49 ` [PATCH net-next v2 6/7] bonding: 3ad: " Nikolay Aleksandrov
2014-09-11 20:49 ` [PATCH net-next v2 7/7] bonding: adjust locking comments Nikolay Aleksandrov
2014-09-13 20:30 ` [PATCH net-next v2 0/7] bonding: get rid of curr_slave_lock 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=1410468568-13781-2-git-send-email-nikolay@redhat.com \
    --to=nikolay@redhat.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=j.vosburgh@gmail.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).