aboutsummaryrefslogtreecommitdiffstats
path: root/disk-io.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-02-01 15:21:04 -0500
committerDavid Sterba <dsterba@suse.cz>2013-02-07 01:19:50 +0100
commit8a46573c2a6bc68385538e5d10131c984df198e9 (patch)
tree015e56dbb591ce6defb594052162b3aca44203be /disk-io.c
parent8795e785ced4b5931bb2c4548d390408fa65e21e (diff)
downloadbtrfs-progs-8a46573c2a6bc68385538e5d10131c984df198e9.tar.gz
btrfs-progs-8a46573c2a6bc68385538e5d10131c984df198e9.tar.xz
btrfs-progs-8a46573c2a6bc68385538e5d10131c984df198e9.zip
Btrfs-progs: return an error if we can't find an fs root
Instead of doing a BUG_ON() if we fail to find the last fs root just return an error so the callers can deal with it how they like. Also we need to actually return an error if we can't find the latest root so that the error handling works. With this btrfsck was able to deal with a file system that was missing a root item but still had extents that referred back to the root. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/disk-io.c b/disk-io.c
index 27befca..5aa9aa3 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -613,7 +613,8 @@ static int find_and_setup_root(struct btrfs_root *tree_root,
root, fs_info, objectid);
ret = btrfs_find_last_root(tree_root, objectid,
&root->root_item, &root->root_key);
- BUG_ON(ret);
+ if (ret)
+ return ret;
blocksize = btrfs_level_size(root, btrfs_root_level(&root->root_item));
generation = btrfs_root_generation(&root->root_item);