btrfsprogs/0168-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch
David Sterba 218848695f Accepting request 208357 from home:dsterba:branches:filesystems
Sync to a long-awaited upstream release. Version update. Only a handful of local packages that will be upstreamed later.

This set of changes is not suitable for direct copy to currently released products because there are changes in mkfs defaults (12.x, 13.x, SLES). Fine for Factory.

OBS-URL: https://build.opensuse.org/request/show/208357
OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=147
2013-11-25 22:58:13 +00:00

30 lines
909 B
Diff

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) {