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

btrfs: check return value of btrfs_commit_transaction in relocation

There are a few places where we don't check the return value of
btrfs_commit_transaction in relocation.c.  Thankfully all these places
have straightforward error handling, so simply change all of the sites
at once.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
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 24213fa4
...@@ -1924,7 +1924,7 @@ int prepare_to_merge(struct reloc_control *rc, int err) ...@@ -1924,7 +1924,7 @@ int prepare_to_merge(struct reloc_control *rc, int err)
list_splice(&reloc_roots, &rc->reloc_roots); list_splice(&reloc_roots, &rc->reloc_roots);
if (!err) if (!err)
btrfs_commit_transaction(trans); err = btrfs_commit_transaction(trans);
else else
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
return err; return err;
...@@ -3496,8 +3496,7 @@ int prepare_to_relocate(struct reloc_control *rc) ...@@ -3496,8 +3496,7 @@ int prepare_to_relocate(struct reloc_control *rc)
*/ */
return PTR_ERR(trans); return PTR_ERR(trans);
} }
btrfs_commit_transaction(trans); return btrfs_commit_transaction(trans);
return 0;
} }
static noinline_for_stack int relocate_block_group(struct reloc_control *rc) static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
...@@ -3656,7 +3655,9 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) ...@@ -3656,7 +3655,9 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
err = PTR_ERR(trans); err = PTR_ERR(trans);
goto out_free; goto out_free;
} }
btrfs_commit_transaction(trans); ret = btrfs_commit_transaction(trans);
if (ret && !err)
err = ret;
out_free: out_free:
ret = clean_dirty_subvols(rc); ret = clean_dirty_subvols(rc);
if (ret < 0 && !err) if (ret < 0 && !err)
......
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