• Josef Bacik's avatar
    Btrfs: check our parent dir when doing a compare send · ebdad913
    Josef Bacik authored
    When doing a send with a parent subvol we will check to see if the file we are
    acting on is being overwritten and move it if we think it may be needed further
    down the line during the send.  We check this by checking its directory and
    making sure it existed in the parent and making sure the file existed in the
    parent.  The problem with this check is that if we create a directory and a file
    in that directory, and then snapshot, and then remove and re-create that same
    directory and file with different inode numbers and then try to snapshot and
    send with the original parent we will try and save the original file inside of
    that directory.  This is a problem because during the receive we move the
    directory out of the way because it is a completely new inode, which makes us
    unable to find the old file inside of the directory when we try to move that out
    of the way for the overwrite.  We fix this by checking the parent directory of
    the inode we think we are overwriting.  If the parent directory generation in
    the send root != the parent directory generation in the parent root then we know
    it is a completely new directory and we need not bother with moving the file out
    of the way because it would have been completely destroyed.  This fixes bz
    60673.  Thanks,
    Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
    Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
    ebdad913
send.c 107 KB