File 0132-Btrfs-progs-make-find_and_setup_root-return-an-error.patch of Package btrfsprogs

From df8b44a2980ace8b2e7483b96a661907e20b8a4c Mon Sep 17 00:00:00 2001
From: Josef Bacik <josef@redhat.com>
Date: Wed, 7 Dec 2011 16:11:23 -0500
Subject: [PATCH 33/35] 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 <josef@redhat.com>
---
 disk-io.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/disk-io.c b/disk-io.c
index 8a8071c..b0b9502 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -438,13 +438,15 @@ 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);
 	root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
 				     blocksize, generation);
-	BUG_ON(!root->node);
+	if (!root->node)
+		return -ENOENT;
 	return 0;
 }
 
-- 
1.7.6.233.gd79bc

openSUSE Build Service is sponsored by