All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven.eckelmann@gmx.de>
To: b.a.t.m.a.n@lists.open-mesh.net
Subject: [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Remove unneeded rcu_read_lock
Date: Thu, 16 Sep 2010 22:18:37 +0200	[thread overview]
Message-ID: <1284668317-19890-5-git-send-email-sven.eckelmann@gmx.de> (raw)
In-Reply-To: <1284668317-19890-1-git-send-email-sven.eckelmann@gmx.de>

Regions which do not use rcu functions don't need to protected by
rcu_read_lock. If we want to protect data from being freed than it must
be covered by the same read-side critical section or otherwise the grace
period may already ended and freed the memory before we called
rcu_read_lock again.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman-adv/gateway_client.c |    4 ----
 batman-adv/originator.c     |    2 --
 2 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/batman-adv/gateway_client.c b/batman-adv/gateway_client.c
index dd96d99..bfac0ff 100644
--- a/batman-adv/gateway_client.c
+++ b/batman-adv/gateway_client.c
@@ -342,9 +342,7 @@ int gw_client_seq_print_text(struct seq_file *seq, void *offset)
 	struct hlist_node *node;
 	int gw_count = 0;
 
-	rcu_read_lock();
 	if (!bat_priv->primary_if) {
-		rcu_read_unlock();
 
 		return seq_printf(seq, "BATMAN mesh %s disabled - please "
 				  "specify interfaces to enable it\n",
@@ -352,7 +350,6 @@ int gw_client_seq_print_text(struct seq_file *seq, void *offset)
 	}
 
 	if (bat_priv->primary_if->if_status != IF_ACTIVE) {
-		rcu_read_unlock();
 
 		return seq_printf(seq, "BATMAN mesh %s disabled - "
 				       "primary interface not active\n",
@@ -365,7 +362,6 @@ int gw_client_seq_print_text(struct seq_file *seq, void *offset)
 		   "outgoingIF", SOURCE_VERSION, REVISION_VERSION_STR,
 		   bat_priv->primary_if->net_dev->name,
 		   bat_priv->primary_if->addr_str, net_dev->name);
-	rcu_read_unlock();
 
 	rcu_read_lock();
 	hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) {
diff --git a/batman-adv/originator.c b/batman-adv/originator.c
index 2250266..3424ac2 100644
--- a/batman-adv/originator.c
+++ b/batman-adv/originator.c
@@ -335,7 +335,6 @@ int orig_seq_print_text(struct seq_file *seq, void *offset)
 				  net_dev->name);
 	}
 
-	rcu_read_lock();
 	seq_printf(seq, "[B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s (%s)]\n",
 		   SOURCE_VERSION, REVISION_VERSION_STR,
 		   bat_priv->primary_if->net_dev->name,
@@ -343,7 +342,6 @@ int orig_seq_print_text(struct seq_file *seq, void *offset)
 	seq_printf(seq, "  %-15s %s (%s/%i) %17s [%10s]: %20s ...\n",
 		   "Originator", "last-seen", "#", TQ_MAX_VALUE, "Nexthop",
 		   "outgoingIF", "Potential nexthops");
-	rcu_read_unlock();
 
 	spin_lock_irqsave(&bat_priv->orig_hash_lock, flags);
 
-- 
1.7.2.3


  parent reply	other threads:[~2010-09-16 20:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-16 20:18 [B.A.T.M.A.N.] Initial rcu locking patchset Sven Eckelmann
2010-09-16 20:18 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Introduce if_list_lock to protect if_list Sven Eckelmann
2010-09-16 20:18 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Protect update side of gw_list Sven Eckelmann
2010-09-16 20:18 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: Always protect list_for_each_entry_rcu with RCU Sven Eckelmann
2010-09-16 20:18 ` Sven Eckelmann [this message]
2010-09-16 21:22 ` [B.A.T.M.A.N.] Adding of basic gw_node/batman_if refcnt Sven Eckelmann
2010-09-17  1:17   ` Sven Eckelmann
2010-09-16 21:22 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Use refcnt to track usage count of gw_node Sven Eckelmann
2010-09-16 21:22 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Use refcnt to track usage count of batman_if Sven Eckelmann
2010-09-16 21:32   ` Sven Eckelmann

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=1284668317-19890-5-git-send-email-sven.eckelmann@gmx.de \
    --to=sven.eckelmann@gmx.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.net \
    --cc=b.a.t.m.a.n@lists.open-mesh.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.