* [PATCH] Btrfs-progs: just return -ENOENT if we don't find the root item
@ 2013-10-23 16:18 Josef Bacik
0 siblings, 0 replies; only message in thread
From: Josef Bacik @ 2013-10-23 16:18 UTC (permalink / raw)
To: linux-btrfs
We were bug_on(slot == 0), but that's just obnoxious, return -ENOENT so we can
handle the situation properly. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
root-tree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/root-tree.c b/root-tree.c
index bdc8504..858fe2f 100644
--- a/root-tree.c
+++ b/root-tree.c
@@ -40,10 +40,11 @@ int btrfs_find_last_root(struct btrfs_root *root, u64 objectid,
ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
if (ret < 0)
goto out;
+ if (path->slots[0] == 0)
+ return -ENOENT;
BUG_ON(ret == 0);
l = path->nodes[0];
- BUG_ON(path->slots[0] == 0);
slot = path->slots[0] - 1;
btrfs_item_key_to_cpu(l, &found_key, slot);
if (found_key.objectid != objectid) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-10-23 16:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-23 16:18 [PATCH] Btrfs-progs: just return -ENOENT if we don't find the root item Josef Bacik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).