Btrfs: Fix for test_range_bit
authorYan <yanzheng@21cn.com>
Tue, 22 Jan 2008 17:46:56 +0000 (12:46 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:03:59 +0000 (11:03 -0400)
test_range_bit doesn't properly handle the case: there's a hole at the
end of the range and there's no other extent_state after the range.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent_map.c

index d71aed341abd9af53ff36690ffe13360f3e74f34..485cf0719b3ce70e568645da13d742d5b20d28a4 100644 (file)
@@ -1336,6 +1336,11 @@ int test_range_bit(struct extent_map_tree *tree, u64 start, u64 end,
                if (start > end)
                        break;
                node = rb_next(node);
+               if (!node) {
+                       if (filled)
+                               bitset = 0;
+                       break;
+               }
        }
        read_unlock_irq(&tree->lock);
        return bitset;