btrfsprogs/0168-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch

30 lines
909 B
Diff
Raw Normal View History

From 6c90b5f56a389b37fcdd85e6dd904288d601b27a Mon Sep 17 00:00:00 2001
From: Josef Bacik <josef@redhat.com>
Date: Wed, 7 Dec 2011 15:54:13 -0500
Subject: [PATCH 168/170] Btrfs-progs: don't bug out if we can't find the last
root
Return an error instead of BUG()'ing out.
Signed-off-by: Josef Bacik <josef@redhat.com>
---
root-tree.c | 5 +++++
1 file changed, 5 insertions(+)
Index: btrfs-progs-v0.20-rc1-598-g8116550e1662/root-tree.c
===================================================================
--- btrfs-progs-v0.20-rc1-598-g8116550e1662.orig/root-tree.c
+++ btrfs-progs-v0.20-rc1-598-g8116550e1662/root-tree.c
@@ -45,6 +45,11 @@ int btrfs_find_last_root(struct btrfs_ro
BUG_ON(ret == 0);
l = path->nodes[0];
+ if (path->slots[0] == 0) {
+ ret = -ENOENT;
+ goto out;
+ }
+
slot = path->slots[0] - 1;
btrfs_item_key_to_cpu(l, &found_key, slot);
if (found_key.objectid != objectid) {