Browse Source

Btrfs: Fix for test_range_bit

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>
Yan 17 years ago
parent
commit
f0c5da1446
1 changed files with 5 additions and 0 deletions
  1. 5 0
      fs/btrfs/extent_map.c

+ 5 - 0
fs/btrfs/extent_map.c

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