]> git.hungrycats.org Git - linux/commitdiff
Btrfs: don't check nodes for extent items
authorJosef Bacik <jbacik@fb.com>
Thu, 5 Jun 2014 20:08:45 +0000 (16:08 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Jul 2014 03:14:03 +0000 (20:14 -0700)
commit 8a56457f5f8fa7c2698ffae8545214c5b96a2cb5 upstream.

The backref code was looking at nodes as well as leaves when we tried to
populate extent item entries.  This is not good, and although we go away with it
for the most part because we'd skip where disk_bytenr != random_memory,
sometimes random_memory would match and suddenly boom.  This fixes that problem.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/backref.c

index 10db21fa09263786db6d094c64ee7b16a1c2c2ae..1e0439111d3428f721a48a35e9c67fc5b2bc98d6 100644 (file)
@@ -984,11 +984,12 @@ again:
                                goto out;
                }
                if (ref->count && ref->parent) {
-                       if (extent_item_pos && !ref->inode_list) {
+                       if (extent_item_pos && !ref->inode_list &&
+                           ref->level == 0) {
                                u32 bsz;
                                struct extent_buffer *eb;
                                bsz = btrfs_level_size(fs_info->extent_root,
-                                                       info_level);
+                                                       ref->level);
                                eb = read_tree_block(fs_info->extent_root,
                                                           ref->parent, bsz, 0);
                                if (!eb || !extent_buffer_uptodate(eb)) {