From 8247b41ac980d125de8aeba6f33f381056ac0ecb Mon Sep 17 00:00:00 2001 From: Yan Zheng Date: Tue, 11 Nov 2008 09:33:29 -0500 Subject: [PATCH] Btrfs: Fix starting search offset inside btrfs_drop_extents btrfs_drop_extents will drop paths and search again when it needs to force COW of higher nodes. It was using the key it found during the last search as the offset for the next search. But, this wasn't always correct. The key could be from before our desired range, and because we're dropping the path, it is possible for file's items to change while we do the search again. The fix here is to make sure we don't search for something smaller than the offset btrfs_drop_extents was called with. Signed-off-by: Chris Mason --- fs/btrfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 4119f9a95320..934bc094bf17 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -436,7 +436,7 @@ next_slot: goto out; } if (recow) { - search_start = key.offset; + search_start = max(key.offset, start); continue; } if (btrfs_key_type(&key) == BTRFS_EXTENT_DATA_KEY) { -- 2.34.1