From patchwork Sat Apr 16 09:30:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 933 Return-Path: Received: from rivolta.investici.org (rivolta.investici.org [78.46.89.173]) by open-mesh.org (Postfix) with ESMTPS id 978D1154497 for ; Sat, 16 Apr 2011 11:31:11 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [78.46.89.173] (rivolta [78.46.89.173]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 9560A10A2A8; Sat, 16 Apr 2011 09:31:09 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.6.0 rivolta.investici.org 9560A10A2A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1302946269; bh=hTBr36G5pzL6JVPii4BoGSc9RlbNrgpijG6IhP 8bX9M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=qVPrQi6FewEYYgz2++7WEf0N6CJKiYUXTEQl5VKR0dyuSM0Ej7orsfUivT5YPLDtD oCpfznlauENYuoiWtkpqfj+VkV7JzAMYZZjrm7I8IraTDFwhgu6ZygbxNZ8iAgcgvMo ESozDZGc5l6pVbbilVdaT8HOnXm3WcwKfndJl6M= From: Antonio Quartulli To: "B.A.T.M.A.N" Date: Sat, 16 Apr 2011 11:30:57 +0200 Message-Id: <1302946257-25173-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1302891416-31451-1-git-send-email-ordex@autistici.org> References: <1302891416-31451-1-git-send-email-ordex@autistici.org> Subject: [B.A.T.M.A.N.] [PATCHv3] batman-adv: orig_hash_find() manages rcu_lock/unlock internally X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Apr 2011 09:31:12 -0000 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 --- 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: