Commit bbae13f8 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: handle btrfs_update_reloc_root failure in prepare_to_merge

btrfs_update_reloc_root will will return errors in the future, so handle
an error properly in prepare_to_merge.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 7934133f
...@@ -1870,10 +1870,21 @@ int prepare_to_merge(struct reloc_control *rc, int err) ...@@ -1870,10 +1870,21 @@ int prepare_to_merge(struct reloc_control *rc, int err)
*/ */
if (!err) if (!err)
btrfs_set_root_refs(&reloc_root->root_item, 1); btrfs_set_root_refs(&reloc_root->root_item, 1);
btrfs_update_reloc_root(trans, root); ret = btrfs_update_reloc_root(trans, root);
/*
* Even if we have an error we need this reloc root back on our
* list so we can clean up properly.
*/
list_add(&reloc_root->root_list, &reloc_roots); list_add(&reloc_root->root_list, &reloc_roots);
btrfs_put_root(root); btrfs_put_root(root);
if (ret) {
btrfs_abort_transaction(trans, ret);
if (!err)
err = ret;
break;
}
} }
list_splice(&reloc_roots, &rc->reloc_roots); list_splice(&reloc_roots, &rc->reloc_roots);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment