Skip to content

Commit 9ae5afd

Browse files
fdmananakdave
authored andcommitted
btrfs: abort transaction when sibling keys check fails for leaves
If the sibling keys check fails before we move keys from one sibling leaf to another, we are not aborting the transaction - we leave that to some higher level caller of btrfs_search_slot() (or anything else that uses it to insert items into a b+tree). This means that the transaction abort will provide a stack trace that omits the b+tree modification call chain. So change this to immediately abort the transaction and therefore get a more useful stack trace that shows us the call chain in the bt+tree modification code. It's also important to immediately abort the transaction just in case some higher level caller is not doing it, as this indicates a very serious corruption and we should stop the possibility of doing further damage. Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 611ccc5 commit 9ae5afd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/btrfs/ctree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3215,6 +3215,7 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
32153215

32163216
if (check_sibling_keys(left, right)) {
32173217
ret = -EUCLEAN;
3218+
btrfs_abort_transaction(trans, ret);
32183219
btrfs_tree_unlock(right);
32193220
free_extent_buffer(right);
32203221
return ret;
@@ -3433,6 +3434,7 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
34333434

34343435
if (check_sibling_keys(left, right)) {
34353436
ret = -EUCLEAN;
3437+
btrfs_abort_transaction(trans, ret);
34363438
goto out;
34373439
}
34383440
return __push_leaf_left(trans, path, min_data_size, empty, left,

0 commit comments

Comments
 (0)