Skip to content

Commit

Permalink
Btrfs: check unused against how much space we actually want
Browse files Browse the repository at this point in the history
There is a bug that may lead to early ENOSPC in our reservation code.  We've
been checking against num_bytes which may be above and beyond what we want to
actually reserve, which could give us a false ENOSPC.  Fix this by making sure
the unused space is above how much we want to reserve and not how much we're
trying to flush.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
  • Loading branch information
Josef Bacik committed Oct 19, 2011
1 parent a8c9e57 commit ef3be45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3472,7 +3472,7 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
*/
if (unused <= space_info->total_bytes) {
unused = space_info->total_bytes - unused;
if (unused >= num_bytes) {
if (unused >= orig_bytes) {
space_info->bytes_may_use += orig_bytes;
ret = 0;
} else {
Expand Down

0 comments on commit ef3be45

Please sign in to comment.