summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-02-01 15:17:07 -0500
committerDavid Sterba <dsterba@suse.cz>2013-02-07 01:19:49 +0100
commit6cba7b1b465530fd754925c35eedbd4794fce1b9 (patch)
tree81870e7bdcc148bcc79f7023497d9a9d2cffc9ae
parent5e7b9d21562cce068079354d28aaf7cd1fc372d7 (diff)
Btrfs-progs: handle errors reading fs roots
A user had a problem where btrfsck would bail out because it was finding extents for a snapshot that had been deleted but not entirely cleaned up. We can handle this case fine, we just need to report an error properly. This patch allowed btrfsck to continue and eventually fix his file system. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
-rw-r--r--btrfsck.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/btrfsck.c b/btrfsck.c
index a7b47911..81c1059d 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -1824,6 +1824,10 @@ static int check_fs_roots(struct btrfs_root *root,
fs_root_objectid(key.objectid)) {
tmp_root = btrfs_read_fs_root_no_cache(root->fs_info,
&key);
+ if (IS_ERR(tmp_root)) {
+ err = 1;
+ goto next;
+ }
ret = check_fs_root(tmp_root, root_cache, &wc);
if (ret)
err = 1;
@@ -1833,6 +1837,7 @@ static int check_fs_roots(struct btrfs_root *root,
process_root_ref(leaf, path.slots[0], &key,
root_cache);
}
+next:
path.slots[0]++;
}
btrfs_release_path(tree_root, &path);
@@ -1994,7 +1999,8 @@ static int check_owner_ref(struct btrfs_root *root,
key.offset = (u64)-1;
ref_root = btrfs_read_fs_root(root->fs_info, &key);
- BUG_ON(IS_ERR(ref_root));
+ if (IS_ERR(ref_root))
+ return 1;
level = btrfs_header_level(buf);
if (level == 0)