• Filipe Manana's avatar
    Btrfs: pin logs earlier when doing a rename exchange operation · 376e5a57
    Filipe Manana authored
    The btrfs_rename_exchange() started as a copy-paste from btrfs_rename(),
    which had a race fixed by my previous patch titled "Btrfs: pin log earlier
    when renaming", and so it suffers from the same problem.
    
    We pin the logs of the affected roots after we insert the new inode
    references, leaving a time window where concurrent tasks logging the
    inodes can end up logging both the new and old references, resulting
    in log trees that when replayed can turn the metadata into inconsistent
    states. This behaviour was added to btrfs_rename() in 2009 without any
    explanation about why not pinning the logs earlier, just leaving a
    comment about the posibility for the race. As of today it's perfectly
    safe and sane to pin the logs before we start doing any of the steps
    involved in the rename operation.
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    376e5a57
inode.c 281 KB