소스 검색

Btrfs: Fix test_range_bit for whole file extents

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>
Chris Mason 15 년 전
부모
커밋
46562cec98
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      fs/btrfs/extent_io.c

+ 4 - 0
fs/btrfs/extent_io.c

@@ -1564,6 +1564,10 @@ int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
 			bitset = 0;
 			bitset = 0;
 			break;
 			break;
 		}
 		}
+
+		if (state->end == (u64)-1)
+			break;
+
 		start = state->end + 1;
 		start = state->end + 1;
 		if (start > end)
 		if (start > end)
 			break;
 			break;