提交 b902e573 编写于 作者: J Jarek Poplawski 提交者: David S. Miller

ipv4: fib_trie: Use tnode_get_child_rcu() and node_parent_rcu() in lookups

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: NJarek Poplawski <jarkao2@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 be916cde
...@@ -1465,7 +1465,7 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, ...@@ -1465,7 +1465,7 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp,
cindex = tkey_extract_bits(mask_pfx(key, current_prefix_length), cindex = tkey_extract_bits(mask_pfx(key, current_prefix_length),
pos, bits); pos, bits);
n = tnode_get_child(pn, cindex); n = tnode_get_child_rcu(pn, cindex);
if (n == NULL) { if (n == NULL) {
#ifdef CONFIG_IP_FIB_TRIE_STATS #ifdef CONFIG_IP_FIB_TRIE_STATS
...@@ -1600,7 +1600,7 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, ...@@ -1600,7 +1600,7 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp,
if (chopped_off <= pn->bits) { if (chopped_off <= pn->bits) {
cindex &= ~(1 << (chopped_off-1)); cindex &= ~(1 << (chopped_off-1));
} else { } else {
struct tnode *parent = node_parent((struct node *) pn); struct tnode *parent = node_parent_rcu((struct node *) pn);
if (!parent) if (!parent)
goto failed; goto failed;
...@@ -1813,7 +1813,7 @@ static struct leaf *trie_firstleaf(struct trie *t) ...@@ -1813,7 +1813,7 @@ static struct leaf *trie_firstleaf(struct trie *t)
static struct leaf *trie_nextleaf(struct leaf *l) static struct leaf *trie_nextleaf(struct leaf *l)
{ {
struct node *c = (struct node *) l; struct node *c = (struct node *) l;
struct tnode *p = node_parent(c); struct tnode *p = node_parent_rcu(c);
if (!p) if (!p)
return NULL; /* trie with just one leaf */ return NULL; /* trie with just one leaf */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册