From: Josef Bacik Date: Fri, 29 Mar 2013 14:09:34 +0000 (-0600) Subject: Btrfs: don't drop path when printing out tree errors in scrub X-Git-Tag: v3.4.39~39 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d50597f63bebaf9de515398c95f0ed4b88ea5224;p=karo-tx-linux.git Btrfs: don't drop path when printing out tree errors in scrub commit d8fe29e9dea8d7d61fd140d8779326856478fc62 upstream. A user reported a panic where we were panicing somewhere in tree_backref_for_extent from scrub_print_warning. He only captured the trace but looking at scrub_print_warning we drop the path right before we mess with the extent buffer to print out a bunch of stuff, which isn't right. So fix this by dropping the path after we use the eb if we need to. Thanks, Signed-off-by: Josef Bacik Signed-off-by: Chris Mason Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 2f3d6f917fb3..682e5da3143a 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -383,7 +383,6 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) eb = path->nodes[0]; ei = btrfs_item_ptr(eb, path->slots[0], struct btrfs_extent_item); item_size = btrfs_item_size_nr(eb, path->slots[0]); - btrfs_release_path(path); if (ret & BTRFS_EXTENT_FLAG_TREE_BLOCK) { do { @@ -398,7 +397,9 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) ret < 0 ? -1 : ref_level, ret < 0 ? -1 : ref_root); } while (ret != 1); + btrfs_release_path(path); } else { + btrfs_release_path(path); swarn.path = path; iterate_extent_inodes(fs_info, found_key.objectid, extent_item_pos, 1,