]> bbs.cooldavid.org Git - net-next-2.6.git/commit
Btrfs: fix data enospc check overflow
authorJosef Bacik <josef@redhat.com>
Fri, 19 Mar 2010 14:38:13 +0000 (14:38 +0000)
committerChris Mason <chris.mason@oracle.com>
Mon, 5 Apr 2010 20:04:50 +0000 (16:04 -0400)
commitab6e24103cbd215e922938a4f58c75194761a60e
treed54479feddd7fe625888dd62084621d4d0871c4b
parent109f6aef5fc436f355ad027f4d97bd696df2049a
Btrfs: fix data enospc check overflow

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: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c