Skip to content

Commit fb686c6

Browse files
josefbacikkdave
authored andcommitted
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: Qu Wenruo <[email protected]> Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 24213fa commit fb686c6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/btrfs/relocation.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,7 @@ int prepare_to_merge(struct reloc_control *rc, int err)
19241924
list_splice(&reloc_roots, &rc->reloc_roots);
19251925

19261926
if (!err)
1927-
btrfs_commit_transaction(trans);
1927+
err = btrfs_commit_transaction(trans);
19281928
else
19291929
btrfs_end_transaction(trans);
19301930
return err;
@@ -3496,8 +3496,7 @@ int prepare_to_relocate(struct reloc_control *rc)
34963496
*/
34973497
return PTR_ERR(trans);
34983498
}
3499-
btrfs_commit_transaction(trans);
3500-
return 0;
3499+
return btrfs_commit_transaction(trans);
35013500
}
35023501

35033502
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)
36563655
err = PTR_ERR(trans);
36573656
goto out_free;
36583657
}
3659-
btrfs_commit_transaction(trans);
3658+
ret = btrfs_commit_transaction(trans);
3659+
if (ret && !err)
3660+
err = ret;
36603661
out_free:
36613662
ret = clean_dirty_subvols(rc);
36623663
if (ret < 0 && !err)

0 commit comments

Comments
 (0)