Skip to content
  • Filipe Manana's avatar
    btrfs: fix reclaim counter leak of space_info objects · d611add4
    Filipe Manana authored
    Whenever we add a ticket to a space_info object we increment the object's
    reclaim_size counter witht the ticket's bytes, and we decrement it with
    the corresponding amount only when we are able to grant the requested
    space to the ticket. When we are not able to grant the space to a ticket,
    or when the ticket is removed due to a signal (e.g. an application has
    received sigterm from the terminal) we never decrement the counter with
    the corresponding bytes from the ticket. This leak can result in the
    space reclaim code to later do much more work than necessary. So fix it
    by decrementing the counter when those two cases happen as well.
    
    Fixes: db161806
    
     ("btrfs: account ticket size at add/delete time")
    Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    d611add4