• Josef Bacik's avatar
    Btrfs: do not reset last_snapshot after relocation · ba8b0289
    Josef Bacik authored
    This was done to allow NO_COW to continue to be NO_COW after relocation but it
    is not right.  When relocating we will convert blocks to FULL_BACKREF that we
    relocate.  We can leave some of these full backref blocks behind if they are not
    cow'ed out during the relocation, like if we fail the relocation with ENOSPC and
    then just drop the reloc tree.  Then when we go to cow the block again we won't
    lookup the extent flags because we won't think there has been a snapshot
    recently which means we will do our normal ref drop thing instead of adding back
    a tree ref and dropping the shared ref.  This will cause btrfs_free_extent to
    blow up because it can't find the ref we are trying to free.  This was found
    with my ref verifying tool.  Thanks,
    Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    ba8b0289
relocation.c 109 KB