• Josef Bacik's avatar
    Btrfs: fix space leak when we fail to reserve metadata space · f4881bc7
    Josef Bacik authored
    Dave reported a warning when running xfstest 275.  We have been leaking delalloc
    metadata space when our reservations fail.  This is because we were improperly
    calculating how much space to free for our checksum reservations.  The problem
    is we would sometimes free up space that had already been freed in another
    thread and we would end up with negative usage for the delalloc space.  This
    patch fixes the problem by calculating how much space the other threads would
    have already freed, and then calculate how much space we need to free had we not
    done the reservation at all, and then freeing any excess space.  This makes
    xfstests 275 no longer have leaked space.  Thanks
    
    Cc: stable@vger.kernel.org
    Reported-by: default avatarDavid Sterba <dsterba@suse.cz>
    Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
    f4881bc7
extent-tree.c 224 KB