Re: [PATCH] btrfs: don't clobber errors in add_remap_tree_entries()

David Sterba
2026-04-13T18:48:32Z

On Wed, Apr 08, 2026 at 02:13:20PM +0100, Mark Harmstone wrote:
> From: Mark Harmstone <maharmstone@fb.com>
>
> 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>