• Josef Bacik's avatar
    Btrfs: fix data enospc check overflow · ab6e2410
    Josef Bacik authored
    
    
    Because we account for reserved space we get from the allocator before we
    actually account for allocating delalloc space, we can have a small window where
    the amount of "used" space in a space_info is more than the total amount of
    space in the space_info.  This will cause a overflow in our check, so it will
    seem like we have _tons_ of free space, and we'll allow reservations to occur
    that will end up larger than the amount of space we have.  I've seen users
    report ENOSPC panic's in cow_file_range a few times recently, so I tried to
    reproduce this problem and found I could reproduce it if I ran one of my tests
    in a loop for like 20 minutes.  With this patch my test ran all night without
    issues.  Thanks,
    Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    ab6e2410
extent-tree.c 202 KB