Skip to content

Commit

Permalink
Btrfs: make sure reserve_metadata_bytes doesn't leak out strange errors
Browse files Browse the repository at this point in the history
The btrfs transaction code will return any errors that come from
reserve_metadata_bytes.  We need to make sure we don't return funny
things like 1 or EAGAIN.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Jul 27, 2011
1 parent 2cf8572 commit 75c195a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3474,6 +3474,8 @@ static int reserve_metadata_bytes(struct btrfs_trans_handle *trans,
if (ret < 0)
goto out;

ret = 0;

/*
* So if we were overcommitted it's possible that somebody else flushed
* out enough space and we simply didn't have enough space to reclaim,
Expand All @@ -3496,10 +3498,13 @@ static int reserve_metadata_bytes(struct btrfs_trans_handle *trans,
goto out;

ret = -EAGAIN;
if (trans || committed)
if (trans)
goto out;

ret = -ENOSPC;
if (committed)
goto out;

trans = btrfs_join_transaction(root);
if (IS_ERR(trans))
goto out;
Expand Down

0 comments on commit 75c195a

Please sign in to comment.