]>
Commit | Line | Data |
---|---|---|
425ebf0b GKH |
1 | From fb686c6824dd6294ca772b92424b8fba666e7d00 Mon Sep 17 00:00:00 2001 |
2 | From: Josef Bacik <josef@toxicpanda.com> | |
3 | Date: Fri, 12 Mar 2021 15:25:34 -0500 | |
4 | Subject: btrfs: check return value of btrfs_commit_transaction in relocation | |
5 | ||
6 | From: Josef Bacik <josef@toxicpanda.com> | |
7 | ||
8 | commit fb686c6824dd6294ca772b92424b8fba666e7d00 upstream. | |
9 | ||
10 | There are a few places where we don't check the return value of | |
11 | btrfs_commit_transaction in relocation.c. Thankfully all these places | |
12 | have straightforward error handling, so simply change all of the sites | |
13 | at once. | |
14 | ||
15 | Reviewed-by: Qu Wenruo <wqu@suse.com> | |
16 | Signed-off-by: Josef Bacik <josef@toxicpanda.com> | |
17 | Reviewed-by: David Sterba <dsterba@suse.com> | |
18 | Signed-off-by: David Sterba <dsterba@suse.com> | |
19 | Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com> | |
20 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
21 | --- | |
22 | fs/btrfs/relocation.c | 9 +++++---- | |
23 | 1 file changed, 5 insertions(+), 4 deletions(-) | |
24 | ||
25 | --- a/fs/btrfs/relocation.c | |
26 | +++ b/fs/btrfs/relocation.c | |
27 | @@ -2511,7 +2511,7 @@ again: | |
28 | list_splice(&reloc_roots, &rc->reloc_roots); | |
29 | ||
30 | if (!err) | |
31 | - btrfs_commit_transaction(trans); | |
32 | + err = btrfs_commit_transaction(trans); | |
33 | else | |
34 | btrfs_end_transaction(trans); | |
35 | return err; | |
36 | @@ -4102,8 +4102,7 @@ int prepare_to_relocate(struct reloc_con | |
37 | */ | |
38 | return PTR_ERR(trans); | |
39 | } | |
40 | - btrfs_commit_transaction(trans); | |
41 | - return 0; | |
42 | + return btrfs_commit_transaction(trans); | |
43 | } | |
44 | ||
45 | static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |
46 | @@ -4263,7 +4262,9 @@ restart: | |
47 | err = PTR_ERR(trans); | |
48 | goto out_free; | |
49 | } | |
50 | - btrfs_commit_transaction(trans); | |
51 | + ret = btrfs_commit_transaction(trans); | |
52 | + if (ret && !err) | |
53 | + err = ret; | |
54 | out_free: | |
55 | ret = clean_dirty_subvols(rc); | |
56 | if (ret < 0 && !err) |