All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jpirko@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	bhutchings@solarflare.com, shemminger@vyatta.com,
	andy@greyhouse.net, fbl@redhat.com, jzupka@redhat.com,
	ivecera@redhat.com
Subject: [patch net-next 1/3 v2] team: Do not hold rcu_read_lock when running netlink cmds
Date: Wed, 16 Nov 2011 22:55:54 +0100	[thread overview]
Message-ID: <20111116215554.GB9631@minipsycho> (raw)
In-Reply-To: <1321478244.3274.5.camel@edumazet-laptop>


Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/team/team.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 60672bb..e5390c7 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1043,8 +1043,7 @@ err_msg_put:
 
 /*
  * Netlink cmd functions should be locked by following two functions.
- * To ensure team_uninit would not be called in between, hold rcu_read_lock
- * all the time.
+ * Since dev gets held here, that ensures dev won't disappear in between.
  */
 static struct team *team_nl_team_get(struct genl_info *info)
 {
@@ -1057,10 +1056,10 @@ static struct team *team_nl_team_get(struct genl_info *info)
 		return NULL;
 
 	ifindex = nla_get_u32(info->attrs[TEAM_ATTR_TEAM_IFINDEX]);
-	rcu_read_lock();
-	dev = dev_get_by_index_rcu(net, ifindex);
+	dev = dev_get_by_index(net, ifindex);
 	if (!dev || dev->netdev_ops != &team_netdev_ops) {
-		rcu_read_unlock();
+		if (dev)
+			dev_put(dev);
 		return NULL;
 	}
 
@@ -1072,7 +1071,7 @@ static struct team *team_nl_team_get(struct genl_info *info)
 static void team_nl_team_put(struct team *team)
 {
 	spin_unlock(&team->lock);
-	rcu_read_unlock();
+	dev_put(team->dev);
 }
 
 static int team_nl_send_generic(struct genl_info *info, struct team *team,
-- 
1.7.6

  reply	other threads:[~2011-11-16 21:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16 21:09 [patch net-next 0/3] team: bug fixes Jiri Pirko
2011-11-16 21:09 ` [patch net-next 1/3] team: Do not hold rcu_read_lock when running netlink cmds Jiri Pirko
2011-11-16 21:17   ` Eric Dumazet
2011-11-16 21:55     ` Jiri Pirko [this message]
2011-11-17  1:36       ` [patch net-next 1/3 v2] " David Miller
2011-11-16 21:09 ` [patch net-next 2/3] team: convert overall spinlock to mutex Jiri Pirko
2011-11-17  1:36   ` David Miller
2011-11-16 21:09 ` [patch net-next 3/3] team: replicate options on register Jiri Pirko
2011-11-17  1:36   ` David Miller
2011-11-17  8:32   ` Eric Dumazet
2011-11-17  9:57     ` Jiri Pirko
2011-11-17 10:00       ` Eric Dumazet
2011-11-17 10:03         ` Eric Dumazet

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=20111116215554.GB9631@minipsycho \
    --to=jpirko@redhat.com \
    --cc=andy@greyhouse.net \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fbl@redhat.com \
    --cc=ivecera@redhat.com \
    --cc=jzupka@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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 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.