• Alexander Block's avatar
    Btrfs: don't assume to be on the correct extent in add_all_parents · 69bca40d
    Alexander Block authored
    add_all_parents did assume that path is already at a correct extent data
    item, which may not be true in case of data extents that were partly
    rewritten and splitted.
    
    We need to check if we're on a matching extent for every item and only
    for the ones after the first. The loop is changed to do this now.
    
    This patch also fixes a bug introduced with commit 3b127fd8 "Btrfs:
    remove obsolete btrfs_next_leaf call from __resolve_indirect_ref".
    The removal of next_leaf did sometimes result in slot==nritems when
    the above described case happens, and thus resulting in invalid values
    (e.g. wanted_obejctid) in add_all_parents (leading to missed backrefs
    or even crashes).
    Signed-off-by: default avatarAlexander Block <ablock84@googlemail.com>
    Signed-off-by: default avatarJan Schmidt <list.btrfs@jan-o-sch.net>
    Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
    69bca40d
backref.c 42.5 KB