[PATCH net-next] ipv4: fib_trie: Use tnode_get_child_rcu() and node_parent_rcu() in lookups

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jarek Poplawski
Date: Tuesday, July 14, 2009 - 2:20 pm

While looking for other fib_trie problems reported by Pawel Staszewski
I noticed there are a few uses of tnode_get_child() and node_parent()
in lookups instead of their rcu versions.

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
(this patch was prepared on top of my 2 today's fib_trie patches)

diff -Nurp a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
--- a/net/ipv4/fib_trie.c	2009-07-14 20:40:39.000000000 +0200
+++ b/net/ipv4/fib_trie.c	2009-07-14 22:41:26.000000000 +0200
@@ -1465,7 +1465,7 @@ static int fn_trie_lookup(struct fib_tab
 			cindex = tkey_extract_bits(mask_pfx(key, current_prefix_length),
 						   pos, bits);
 
-		n = tnode_get_child(pn, cindex);
+		n = tnode_get_child_rcu(pn, cindex);
 
 		if (n == NULL) {
 #ifdef CONFIG_IP_FIB_TRIE_STATS
@@ -1600,7 +1600,7 @@ backtrace:
 		if (chopped_off <= pn->bits) {
 			cindex &= ~(1 << (chopped_off-1));
 		} else {
-			struct tnode *parent = node_parent((struct node *) pn);
+			struct tnode *parent = node_parent_rcu((struct node *) pn);
 			if (!parent)
 				goto failed;
 
@@ -1813,7 +1813,7 @@ static struct leaf *trie_firstleaf(struc
 static struct leaf *trie_nextleaf(struct leaf *l)
 {
 	struct node *c = (struct node *) l;
-	struct tnode *p = node_parent(c);
+	struct tnode *p = node_parent_rcu(c);
 
 	if (!p)
 		return NULL;	/* trie with just one leaf */
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Thu Jun 25, 8:48 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Thu Jun 25, 2:52 pm)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Fri Jun 26, 3:06 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Jorge Boncompte [DTI2], (Fri Jun 26, 3:26 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Fri Jun 26, 3:47 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paul E. McKenney, (Fri Jun 26, 10:05 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Fri Jun 26, 10:26 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paul E. McKenney, (Fri Jun 26, 11:21 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Sat Jun 27, 5:28 pm)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Sun Jun 28, 8:32 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Sun Jun 28, 8:48 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Mon Jun 29, 12:57 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Mon Jun 29, 1:08 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Mon Jun 29, 1:47 am)
Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits, Paweł Staszewski, (Mon Jun 29, 2:43 am)
Re: [PATCH net-2.6] Re: rib_trie / Fix inflate_threshold_r ..., Paweł Staszewski, (Mon Jun 29, 2:51 am)
Re: [PATCH net-2.6] Re: rib_trie / Fix inflate_threshold_r ..., Paweł Staszewski, (Mon Jun 29, 9:24 am)
Re: [PATCH net-2.6] Re: rib_trie / Fix inflate_threshold_r ..., Paweł Staszewski, (Tue Jun 30, 1:16 pm)
Re: [PATCH net-2.6] Re: rib_trie / Fix inflate_threshold_r ..., Paweł Staszewski, (Tue Jun 30, 4:31 pm)
Re: [PATCH net-2.6] Re: rib_trie / Fix inflate_threshold_r ..., Paweł Staszewski, (Wed Jul 1, 10:43 pm)
Re: [PATCH net-2.6] Re: rib_trie / Fix inflate_threshold_r ..., Stephen Hemminger, (Fri Jul 10, 8:29 am)
[PATCH net-next] ipv4: fib_trie: Use tnode_get_child_rcu() ..., Jarek Poplawski, (Tue Jul 14, 2:20 pm)