Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: don't clobber errors in add_remap_tree_entries()

In add_remap_tree_entries(), we only process a certain number of entries
at a time, meaning we may need to loop.

But because we weren't checking the return value of btrfs_insert_empty_items()
within the loop, this meant that if the last iteration of the loop
succeeded but a previous iteration failed, we were erroneously returning
0.

Fix this by breaking the loop early if btrfs_insert_empty_items() fails.

Fixes: b56f35560b82 ("btrfs: handle setting up relocation of block group with remap-tree")
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Mark Harmstone and committed by
David Sterba
44366af7 41e706c0

+1 -1
+1 -1
fs/btrfs/relocation.c
··· 3876 3876 ret = btrfs_insert_empty_items(trans, fs_info->remap_root, path, &batch); 3877 3877 btrfs_release_path(path); 3878 3878 3879 - if (num_entries <= max_items) 3879 + if (ret || num_entries <= max_items) 3880 3880 break; 3881 3881 3882 3882 num_entries -= max_items;