Skip to content

Commit

Permalink
btrfs: check return value of btrfs_commit_transaction in relocation
Browse files Browse the repository at this point in the history
commit fb686c6 upstream.

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: Qu Wenruo <wqu@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Josef Bacik authored and Greg Kroah-Hartman committed Jun 14, 2023
1 parent ea0d413 commit 6f37162
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fs/btrfs/relocation.c
Original file line number Diff line number Diff line change
@@ -1895,7 +1895,7 @@ int prepare_to_merge(struct reloc_control *rc, int err)
list_splice(&reloc_roots, &rc->reloc_roots);

if (!err)
btrfs_commit_transaction(trans);
err = btrfs_commit_transaction(trans);
else
btrfs_end_transaction(trans);
return err;
@@ -3270,8 +3270,7 @@ int prepare_to_relocate(struct reloc_control *rc)
*/
return PTR_ERR(trans);
}
btrfs_commit_transaction(trans);
return 0;
return btrfs_commit_transaction(trans);
}

static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
@@ -3443,7 +3442,9 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
err = PTR_ERR(trans);
goto out_free;
}
btrfs_commit_transaction(trans);
ret = btrfs_commit_transaction(trans);
if (ret && !err)
err = ret;
out_free:
ret = clean_dirty_subvols(rc);
if (ret < 0 && !err)

0 comments on commit 6f37162

Please sign in to comment.