Skip to content

Commit

Permalink
Btrfs: Fix test_range_bit for whole file extents
Browse files Browse the repository at this point in the history
If test_range_bit finds an extent that goes all the way to (u64)-1, it
can incorrectly wrap the u64 instead of treaing it like the end of
the address space.

This just adds a check for the highest possible offset so we don't wrap.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Sep 24, 2009
1 parent 42daec2 commit 46562ce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
@@ -1564,6 +1564,10 @@ int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
bitset = 0;
break;
}

if (state->end == (u64)-1)
break;

start = state->end + 1;
if (start > end)
break;

0 comments on commit 46562ce

Please sign in to comment.