aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-11-13 09:59:33 -0500
committerChris Mason <chris.mason@oracle.com>2008-11-13 09:59:33 -0500
commit2ed6d66408527be0d1c6131d44cec7e86008ba26 (patch)
tree2bed676124963bee4fce1d61c42c2ff8df0f953c /fs
parent6f3577bdc768e6dae3c4d419e89b5a904f470728 (diff)
Btrfs: Fix handling of space info full during allocations
When we fail to allocate a new block group, we should still do the checks to make sure allocations try again with the minimum requested allocation size. This also fixes a deadlock that come from a missed down_read in the chunk allocation failure handling. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index b7530c3ac20..22820f91d2b 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2301,9 +2301,9 @@ new_group_no_lock:
up_read(&space_info->groups_sem);
ret = do_chunk_alloc(trans, root, num_bytes +
2 * 1024 * 1024, data, 1);
- if (ret < 0)
- break;
down_read(&space_info->groups_sem);
+ if (ret < 0)
+ goto loop_check;
head = &space_info->block_groups;
/*
* we've allocated a new chunk, keep
@@ -2314,6 +2314,7 @@ new_group_no_lock:
} else if (!allowed_chunk_alloc) {
space_info->force_alloc = 1;
}
+loop_check:
if (keep_going) {
cur = head->next;
extra_loop = 0;