Skip to content
  • Josef Bacik's avatar
    Btrfs: fix possible panic on unmount · 11dfe35a
    Josef Bacik authored
    
    
    We can race with the unmount of an fs and the stopping of a kthread where we
    will free the block group before we're done using it.  The reason for this is
    because we do not hold a reference on the block group while its caching, since
    the allocator drops its reference once it exits or moves on to the next block
    group.  This patch fixes the problem by taking a reference to the block group
    before we start caching and dropping it when we're done to make sure all
    accesses to the block group are safe.  Thanks,
    
    Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    11dfe35a