* [B.A.T.M.A.N.] [PATCH] batman-adv: orig_hash_find() manages rcu_lock/unlock internally
@ 2011-04-15 18:16 Antonio Quartulli
2011-04-16 8:02 ` Sven Eckelmann
2011-04-16 9:30 ` [B.A.T.M.A.N.] [PATCHv3] " Antonio Quartulli
0 siblings, 2 replies; 4+ messages in thread
From: Antonio Quartulli @ 2011-04-15 18:16 UTC (permalink / raw)
To: B.A.T.M.A.N
orig_hash_find() manages rcu_lock/unlock internally and doesn't need to
be surrounded by rcu_read_lock() / rcu_read_unlock() anymore
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
routing.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/routing.c b/routing.c
index f6c6422..634a44d 100644
--- a/routing.c
+++ b/routing.c
@@ -1310,14 +1310,11 @@ int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
}
/* get routing information */
- rcu_read_lock();
orig_node = orig_hash_find(bat_priv, unicast_packet->dest);
if (!orig_node)
goto unlock;
- rcu_read_unlock();
-
/* find_router() increases neigh_nodes refcount if found. */
neigh_node = find_router(bat_priv, orig_node, recv_if);
@@ -1464,14 +1461,11 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (bcast_packet->ttl < 2)
goto out;
- rcu_read_lock();
orig_node = orig_hash_find(bat_priv, bcast_packet->orig);
if (!orig_node)
goto rcu_unlock;
- rcu_read_unlock();
-
spin_lock_bh(&orig_node->bcast_seqno_lock);
/* check whether the packet is a duplicate */
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: orig_hash_find() manages rcu_lock/unlock internally
2011-04-15 18:16 [B.A.T.M.A.N.] [PATCH] batman-adv: orig_hash_find() manages rcu_lock/unlock internally Antonio Quartulli
@ 2011-04-16 8:02 ` Sven Eckelmann
2011-04-16 9:30 ` [B.A.T.M.A.N.] [PATCHv3] " Antonio Quartulli
1 sibling, 0 replies; 4+ messages in thread
From: Sven Eckelmann @ 2011-04-16 8:02 UTC (permalink / raw)
To: b.a.t.m.a.n
[-- Attachment #1: Type: Text/Plain, Size: 1497 bytes --]
Antonio Quartulli wrote:
> orig_hash_find() manages rcu_lock/unlock internally and doesn't need to
> be surrounded by rcu_read_lock() / rcu_read_unlock() anymore
>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Valid point, but incorrect implementation
> ---
> routing.c | 6 ------
> 1 files changed, 0 insertions(+), 6 deletions(-)
>
> diff --git a/routing.c b/routing.c
> index f6c6422..634a44d 100644
> --- a/routing.c
> +++ b/routing.c
> @@ -1310,14 +1310,11 @@ int route_unicast_packet(struct sk_buff *skb,
> struct hard_iface *recv_if) }
>
> /* get routing information */
> - rcu_read_lock();
> orig_node = orig_hash_find(bat_priv, unicast_packet->dest);
>
> if (!orig_node)
> goto unlock;
>
> - rcu_read_unlock();
> -
You forgot to fix the rcu_read_unlock after the label unlock.
> /* find_router() increases neigh_nodes refcount if found. */
> neigh_node = find_router(bat_priv, orig_node, recv_if);
>
> @@ -1464,14 +1461,11 @@ int recv_bcast_packet(struct sk_buff *skb, struct
> hard_iface *recv_if) if (bcast_packet->ttl < 2)
> goto out;
>
> - rcu_read_lock();
> orig_node = orig_hash_find(bat_priv, bcast_packet->orig);
>
> if (!orig_node)
> goto rcu_unlock;
>
> - rcu_read_unlock();
> -
> spin_lock_bh(&orig_node->bcast_seqno_lock);
>
> /* check whether the packet is a duplicate */
You forgot to fix the rcu_read_unlock after the label rcu_unlock.
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [B.A.T.M.A.N.] [PATCHv3] batman-adv: orig_hash_find() manages rcu_lock/unlock internally
2011-04-15 18:16 [B.A.T.M.A.N.] [PATCH] batman-adv: orig_hash_find() manages rcu_lock/unlock internally Antonio Quartulli
2011-04-16 8:02 ` Sven Eckelmann
@ 2011-04-16 9:30 ` Antonio Quartulli
2011-04-18 15:05 ` Marek Lindner
1 sibling, 1 reply; 4+ messages in thread
From: Antonio Quartulli @ 2011-04-16 9:30 UTC (permalink / raw)
To: B.A.T.M.A.N
orig_hash_find() manages rcu_lock/unlock internally and doesn't need to
be surrounded by rcu_read_lock() / rcu_read_unlock() anymore
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
routing.c | 16 ++--------------
1 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/routing.c b/routing.c
index f6c6422..2d77bd3 100644
--- a/routing.c
+++ b/routing.c
@@ -1310,13 +1310,10 @@ int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
}
/* get routing information */
- rcu_read_lock();
orig_node = orig_hash_find(bat_priv, unicast_packet->dest);
if (!orig_node)
- goto unlock;
-
- rcu_read_unlock();
+ goto out;
/* find_router() increases neigh_nodes refcount if found. */
neigh_node = find_router(bat_priv, orig_node, recv_if);
@@ -1362,10 +1359,7 @@ int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
/* route it */
send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
ret = NET_RX_SUCCESS;
- goto out;
-unlock:
- rcu_read_unlock();
out:
if (neigh_node)
neigh_node_free_ref(neigh_node);
@@ -1464,13 +1458,10 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (bcast_packet->ttl < 2)
goto out;
- rcu_read_lock();
orig_node = orig_hash_find(bat_priv, bcast_packet->orig);
if (!orig_node)
- goto rcu_unlock;
-
- rcu_read_unlock();
+ goto out;
spin_lock_bh(&orig_node->bcast_seqno_lock);
@@ -1501,9 +1492,6 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
ret = NET_RX_SUCCESS;
goto out;
-rcu_unlock:
- rcu_read_unlock();
- goto out;
spin_unlock:
spin_unlock_bh(&orig_node->bcast_seqno_lock);
out:
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCHv3] batman-adv: orig_hash_find() manages rcu_lock/unlock internally
2011-04-16 9:30 ` [B.A.T.M.A.N.] [PATCHv3] " Antonio Quartulli
@ 2011-04-18 15:05 ` Marek Lindner
0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2011-04-18 15:05 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Saturday 16 April 2011 11:30:57 Antonio Quartulli wrote:
> orig_hash_find() manages rcu_lock/unlock internally and doesn't need to
> be surrounded by rcu_read_lock() / rcu_read_unlock() anymore
Applied in revision ffe4329.
Thanks,
Marek
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-18 15:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-15 18:16 [B.A.T.M.A.N.] [PATCH] batman-adv: orig_hash_find() manages rcu_lock/unlock internally Antonio Quartulli
2011-04-16 8:02 ` Sven Eckelmann
2011-04-16 9:30 ` [B.A.T.M.A.N.] [PATCHv3] " Antonio Quartulli
2011-04-18 15:05 ` Marek Lindner
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).