diff options
author | Filipe David Borba Manana <fdmanana@gmail.com> | 2013-08-05 16:25:12 +0100 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 08:04:55 -0400 |
commit | 09fb99a696412ae0fceeafc06c987903416503b9 (patch) | |
tree | c541ed0dc8707e9b5a183b637e7eb58a1306095c /fs/btrfs/extent-tree.c | |
parent | ada9af215cf7ce663ff3bf9d255923d75b57a4ce (diff) | |
download | op-kernel-dev-09fb99a696412ae0fceeafc06c987903416503b9.zip op-kernel-dev-09fb99a696412ae0fceeafc06c987903416503b9.tar.gz |
Btrfs: return ENOSPC when target space is full
In extent-tree.c:do_chunk_alloc(), early on we returned 0 (success)
when the target space was full and when chunk allocation is needed.
However, later on in that same function we return ENOSPC if
btrfs_alloc_chunk() fails (and chunk allocation was needed) and
set the space's full flag.
This was inconsistent, as -ENOSPC should be returned if the space
is full and a chunk allocation needs to performed. If the space is
full but no chunk allocation is needed, just return 0 (success).
Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a073f3e..277d2c2 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3836,8 +3836,12 @@ again: if (force < space_info->force_alloc) force = space_info->force_alloc; if (space_info->full) { + if (should_alloc_chunk(extent_root, space_info, force)) + ret = -ENOSPC; + else + ret = 0; spin_unlock(&space_info->lock); - return 0; + return ret; } if (!should_alloc_chunk(extent_root, space_info, force)) { |