summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-03-12 15:25:34 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-06-14 10:35:26 +0200
commit1a5353475df8fcaf200fecc9e961a3900d15e891 (patch)
tree6e1ce1d6fe5281328e5cf1ba3e298ad16d95bd45
parent62a4fee01a9e9c247b3f130fc0170b06072b041e (diff)
downloadlinux-stable-1a5353475df8fcaf200fecc9e961a3900d15e891.tar.gz
linux-stable-1a5353475df8fcaf200fecc9e961a3900d15e891.tar.bz2
linux-stable-1a5353475df8fcaf200fecc9e961a3900d15e891.zip
btrfs: check return value of btrfs_commit_transaction in relocation
commit fb686c6824dd6294ca772b92424b8fba666e7d00 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>
-rw-r--r--fs/btrfs/relocation.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 313547442a6e..33700561c582 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2387,7 +2387,7 @@ again:
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;
@@ -4014,8 +4014,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)
@@ -4210,7 +4209,9 @@ restart:
err = PTR_ERR(trans);
goto out_free;
}
- btrfs_commit_transaction(trans);
+ ret = btrfs_commit_transaction(trans);
+ if (ret && !err)
+ err = ret;
out_free:
btrfs_free_block_rsv(fs_info, rc->block_rsv);
btrfs_free_path(path);