Skip to content

Commit df8b44a

Browse files
author
Josef Bacik
committed
Btrfs-progs: make find_and_setup_root return an error
Don't BUG(), return an error so the recovery program can work its mojo. Signed-off-by: Josef Bacik <[email protected]>
1 parent 412d4f1 commit df8b44a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

disk-io.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,15 @@ static int find_and_setup_root(struct btrfs_root *tree_root,
438438
root, fs_info, objectid);
439439
ret = btrfs_find_last_root(tree_root, objectid,
440440
&root->root_item, &root->root_key);
441-
BUG_ON(ret);
441+
if (ret)
442+
return ret;
442443

443444
blocksize = btrfs_level_size(root, btrfs_root_level(&root->root_item));
444445
generation = btrfs_root_generation(&root->root_item);
445446
root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
446447
blocksize, generation);
447-
BUG_ON(!root->node);
448+
if (!root->node)
449+
return -ENOENT;
448450
return 0;
449451
}
450452

0 commit comments

Comments
 (0)