diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a4db88da125e9ba8d9d5441160b629c455d4acf1..b172b7fa4889f4bb162d5fc85486bc3a540c6f44 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5079,7 +5079,9 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, * group is does point to and try again */ if (!last_ptr_loop && last_ptr->block_group && - last_ptr->block_group != block_group) { + last_ptr->block_group != block_group && + index <= + get_block_group_index(last_ptr->block_group)) { btrfs_put_block_group(block_group); block_group = last_ptr->block_group;