]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Btrfs: cleanup error handling in build_backref_tree
authorJosef Bacik <jbacik@fb.com>
Fri, 19 Sep 2014 14:40:00 +0000 (10:40 -0400)
committerJiri Slaby <jslaby@suse.cz>
Fri, 31 Oct 2014 14:11:05 +0000 (15:11 +0100)
commit3ffb5771a40b0aa98c6c6de7976de5742f3d7c10
tree99dc48064553c7596705d6049e5acd61f1579e2e
parent1125942d412f684b24d7a307888cd9dec99e3779
Btrfs: cleanup error handling in build_backref_tree

commit 75bfb9aff45e44625260f52a5fd581b92ace3e62 upstream.

When balance panics it tends to panic in the

BUG_ON(!upper->checked);

test, because it means it couldn't build the backref tree properly.  This is
annoying to users and frankly a recoverable error, nothing in this function is
actually fatal since it is just an in-memory building of the backrefs for a
given bytenr.  So go through and change all the BUG_ON()'s to ASSERT()'s, and
fix the BUG_ON(!upper->checked) thing to just return an error.

This patch also fixes the error handling so it tears down the work we've done
properly.  This code was horribly broken since we always just panic'ed instead
of actually erroring out, so it needed to be completely re-worked.  With this
patch my broken image no longer panics when I mount it.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/btrfs/relocation.c