• Josef Bacik's avatar
    Btrfs: check roots last log commit when checking if an inode has been logged · a5874ce6
    Josef Bacik authored
    Liu introduced a local copy of the last log commit for an inode to make sure we
    actually log an inode even if a log commit has already taken place.  In order to
    make sure we didn't relog the same inode multiple times he set this local copy
    to the current trans when we log the inode, because usually we log the inode and
    then sync the log.  The exception to this is during rename, we will relog an
    inode if the name changed and it is already in the log.  The problem with this
    is then we go to sync the inode, and our check to see if the inode has already
    been logged is tripped and we don't sync the log.  To fix this we need to _also_
    check against the roots last log commit, because it could be less than what is
    in our local copy of the log commit.  This fixes a bug where we rename a file
    into a directory and then fsync the directory and then on remount the directory
    is no longer there.  Thanks,
    Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
    Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
    a5874ce6
btrfs_inode.h 6.82 KB