Skip to content

Commit 8289ed9

Browse files
adam900710kdave
authored andcommitted
btrfs: replace the BUG_ON in btrfs_del_root_ref with proper error handling
I hit the BUG_ON() with generic/475 test case, and to my surprise, all callers of btrfs_del_root_ref() are already aborting transaction, thus there is not need for such BUG_ON(), just go to @out label and caller will properly handle the error. CC: [email protected] # 5.4+ Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 5911f53 commit 8289ed9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/btrfs/root-tree.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ int btrfs_del_root_ref(struct btrfs_trans_handle *trans, u64 root_id,
336336
key.offset = ref_id;
337337
again:
338338
ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1);
339-
BUG_ON(ret < 0);
339+
if (ret < 0)
340+
goto out;
340341
if (ret == 0) {
341342
leaf = path->nodes[0];
342343
ref = btrfs_item_ptr(leaf, path->slots[0],

0 commit comments

Comments
 (0)