• Chris Mason's avatar
    Btrfs: fix relocation races · 7585717f
    Chris Mason authored
    The recent commit to get rid of our trans_mutex introduced
    some races with block group relocation.  The problem is that relocation
    needs to do some record keeping about each root, and it was relying
    on the transaction mutex to coordinate things in subtle ways.
    
    This fix adds a mutex just for the relocation code and makes sure
    it doesn't have a big impact on normal operations.  The race is
    really fixed in btrfs_record_root_in_trans, which is where we
    step back and wait for the relocation code to finish accounting
    setup.
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    7585717f
relocation.c 103 KB