Skip to content

Commit 765f3ce

Browse files
lorddoskiaskdave
authored andcommitted
btrfs: Handle btrfs_set_extent_delalloc failure in relocate_file_extent_cluster
Essentially duplicate the error handling from the above block which handles the !PageUptodate(page) case and additionally clear EXTENT_BOUNDARY. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent ac01f26 commit 765f3ce

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

fs/btrfs/relocation.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,8 +3268,22 @@ static int relocate_file_extent_cluster(struct inode *inode,
32683268
nr++;
32693269
}
32703270

3271-
btrfs_set_extent_delalloc(inode, page_start, page_end, 0, NULL,
3272-
0);
3271+
ret = btrfs_set_extent_delalloc(inode, page_start, page_end, 0,
3272+
NULL, 0);
3273+
if (ret) {
3274+
unlock_page(page);
3275+
put_page(page);
3276+
btrfs_delalloc_release_metadata(BTRFS_I(inode),
3277+
PAGE_SIZE);
3278+
btrfs_delalloc_release_extents(BTRFS_I(inode),
3279+
PAGE_SIZE);
3280+
3281+
clear_extent_bits(&BTRFS_I(inode)->io_tree,
3282+
page_start, page_end,
3283+
EXTENT_LOCKED | EXTENT_BOUNDARY);
3284+
goto out;
3285+
3286+
}
32733287
set_page_dirty(page);
32743288

32753289
unlock_extent(&BTRFS_I(inode)->io_tree,

0 commit comments

Comments
 (0)