Skip to content

Commit 6217b0f

Browse files
josefbacikkdave
authored andcommitted
btrfs: reloc: clean dirty subvols if we fail to start a transaction
If we do merge_reloc_roots() we could insert a few roots onto the dirty subvol roots list, where we hold a ref on them. If we fail to start the transaction we need to run clean_dirty_subvols() in order to cleanup the refs. CC: [email protected] # 5.4+ Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent fb2d83e commit 6217b0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/btrfs/relocation.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4082,10 +4082,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
40824082
goto out_free;
40834083
}
40844084
btrfs_commit_transaction(trans);
4085+
out_free:
40854086
ret = clean_dirty_subvols(rc);
40864087
if (ret < 0 && !err)
40874088
err = ret;
4088-
out_free:
40894089
btrfs_free_block_rsv(fs_info, rc->block_rsv);
40904090
btrfs_free_path(path);
40914091
return err;
@@ -4501,10 +4501,10 @@ int btrfs_recover_relocation(struct btrfs_root *root)
45014501
trans = btrfs_join_transaction(rc->extent_root);
45024502
if (IS_ERR(trans)) {
45034503
err = PTR_ERR(trans);
4504-
goto out_free;
4504+
goto out_clean;
45054505
}
45064506
err = btrfs_commit_transaction(trans);
4507-
4507+
out_clean:
45084508
ret = clean_dirty_subvols(rc);
45094509
if (ret < 0 && !err)
45104510
err = ret;

0 commit comments

Comments
 (0)