diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 549a5f327428..944877a363fa 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1179,7 +1179,6 @@ static void submit_one_async_extent(struct async_chunk *async_chunk, goto done; } - lock_extent(io_tree, start, end, NULL); ret = btrfs_reserve_extent(root, async_extent->ram_size, async_extent->compressed_size, async_extent->compressed_size, @@ -1195,6 +1194,8 @@ static void submit_one_async_extent(struct async_chunk *async_chunk, goto done; } + lock_extent(io_tree, start, end, NULL); + /* Here we're doing allocation and writeback of the compressed pages */ em = create_io_em(inode, start, async_extent->ram_size, /* len */