btrfs: handle btrfs_update_reloc_root failure in insert_dirty_subvol

btrfs_update_reloc_root will will return errors in the future, so handle
the error properly in insert_dirty_subvol.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2021-03-12 15:25:18 -05:00 committed by David Sterba
parent ac54da6c37
commit 7934133fae

View File

@ -1571,6 +1571,7 @@ static int insert_dirty_subvol(struct btrfs_trans_handle *trans,
{ {
struct btrfs_root *reloc_root = root->reloc_root; struct btrfs_root *reloc_root = root->reloc_root;
struct btrfs_root_item *reloc_root_item; struct btrfs_root_item *reloc_root_item;
int ret;
/* @root must be a subvolume tree root with a valid reloc tree */ /* @root must be a subvolume tree root with a valid reloc tree */
ASSERT(root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID); ASSERT(root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID);
@ -1581,7 +1582,9 @@ static int insert_dirty_subvol(struct btrfs_trans_handle *trans,
sizeof(reloc_root_item->drop_progress)); sizeof(reloc_root_item->drop_progress));
btrfs_set_root_drop_level(reloc_root_item, 0); btrfs_set_root_drop_level(reloc_root_item, 0);
btrfs_set_root_refs(reloc_root_item, 0); btrfs_set_root_refs(reloc_root_item, 0);
btrfs_update_reloc_root(trans, root); ret = btrfs_update_reloc_root(trans, root);
if (ret)
return ret;
if (list_empty(&root->reloc_dirty_list)) { if (list_empty(&root->reloc_dirty_list)) {
btrfs_grab_root(root); btrfs_grab_root(root);