Skip to content

Commit

Permalink
radix_tree: clean away saw_unset_tag leftovers
Browse files Browse the repository at this point in the history
radix_tree_tag_get()'s BUG (when it sees a tag after saw_unset_tag) was
unsafe and removed in 2.6.34, but the pointless saw_unset_tag left behind.

Remove it now, and return 0 as soon as we see unset tag - we already rely
upon the root tag to be correct, returning 0 immediately if it's not set.

Signed-off-by: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Hugh Dickins authored and torvalds committed Nov 1, 2011
1 parent 0dabec9 commit 3fa36ac
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/radix-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ int radix_tree_tag_get(struct radix_tree_root *root,
{
unsigned int height, shift;
struct radix_tree_node *node;
int saw_unset_tag = 0;

/* check the root's tag bit */
if (!root_tag_get(root, tag))
Expand All @@ -603,15 +602,10 @@ int radix_tree_tag_get(struct radix_tree_root *root,
return 0;

offset = (index >> shift) & RADIX_TREE_MAP_MASK;

/*
* This is just a debug check. Later, we can bale as soon as
* we see an unset tag.
*/
if (!tag_get(node, tag, offset))
saw_unset_tag = 1;
return 0;
if (height == 1)
return !!tag_get(node, tag, offset);
return 1;
node = rcu_dereference_raw(node->slots[offset]);
shift -= RADIX_TREE_MAP_SHIFT;
height--;
Expand Down

0 comments on commit 3fa36ac

Please sign in to comment.