Skip to content
  • Liu Bo's avatar
    Btrfs: fix memory leak of block group cache · c79a1751
    Liu Bo authored
    
    
    While processing delayed refs, we may update block group's statistics
    and attach it to cur_trans->dirty_bgs, and later writing dirty block
    groups will process the list, which happens during
    btrfs_commit_transaction().
    
    For whatever reason, the transaction is aborted and dirty_bgs
    is not processed in cleanup_transaction(), we end up with memory leak
    of these dirty block group cache.
    
    Since btrfs_start_dirty_block_groups() doesn't make it go to the commit
    critical section, this also adds the cleanup work inside it.
    
    Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    c79a1751