summaryrefslogtreecommitdiff
path: root/extent-tree.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2017-06-26 11:34:41 -0600
committerDavid Sterba <dsterba@suse.com>2017-07-20 17:43:43 +0200
commitd0379cc1d0a34313e7436cdc75e418515f9b03fc (patch)
treee397ac9c665e41e0bd133956fae9f409f319b6ea /extent-tree.c
parent3987fb6f076485e8e63aa279e0d3438084b5dcf4 (diff)
Btrfs-progs: fix infinite loop in find_free_extent
If the found %ins is crossing a stripe len, ie. BTRFS_STRIPE_LEN, we'd search again with a stripe-aligned %search_start. The current code calculates %search_start by adding a wrong offset, in order to fix it, the start position of the block group should be taken, otherwise, it'll end up with looking at the same block group forever. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'extent-tree.c')
-rw-r--r--extent-tree.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/extent-tree.c b/extent-tree.c
index 75ed94f..46b8a05 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -2611,8 +2611,9 @@ check_failed:
goto no_bg_cache;
bg_offset = ins->objectid - bg_cache->key.objectid;
- search_start = round_up(bg_offset + num_bytes,
- BTRFS_STRIPE_LEN) + bg_offset;
+ search_start = round_up(
+ bg_offset + num_bytes, BTRFS_STRIPE_LEN) +
+ bg_cache->key.objectid;
goto new_group;
}
no_bg_cache: