btrfs-progs: lowmem check: Fix false alert about referencer count mismatch
authorLu Fengqi <lufq.fnst@cn.fujitsu.com>
Fri, 3 Nov 2017 08:28:05 +0000 (16:28 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 14 Nov 2017 14:59:01 +0000 (15:59 +0100)
The normal back reference counting doesn't care about the extent referred
by the extent data in the shared leaf. The check_extent_data_backref
function need to skip the leaf that owner mismatch with the root_id.

Reported-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c

index 5750bb7..a93ac2c 100644 (file)
@@ -12468,7 +12468,8 @@ static int check_extent_data_backref(struct btrfs_fs_info *fs_info,
                leaf = path.nodes[0];
                slot = path.slots[0];
 
-               if (slot >= btrfs_header_nritems(leaf))
+               if (slot >= btrfs_header_nritems(leaf) ||
+                   btrfs_header_owner(leaf) != root_id)
                        goto next;
                btrfs_item_key_to_cpu(leaf, &key, slot);
                if (key.objectid != objectid || key.type != BTRFS_EXTENT_DATA_KEY)