diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-11-13 09:59:33 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-11-13 09:59:33 -0500 |
commit | 2ed6d66408527be0d1c6131d44cec7e86008ba26 (patch) | |
tree | 2bed676124963bee4fce1d61c42c2ff8df0f953c /fs/btrfs | |
parent | 6f3577bdc768e6dae3c4d419e89b5a904f470728 (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/btrfs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index b7530c3ac206..22820f91d2b0 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2301,9 +2301,9 @@ new_group_no_lock: | |||
2301 | up_read(&space_info->groups_sem); | 2301 | up_read(&space_info->groups_sem); |
2302 | ret = do_chunk_alloc(trans, root, num_bytes + | 2302 | ret = do_chunk_alloc(trans, root, num_bytes + |
2303 | 2 * 1024 * 1024, data, 1); | 2303 | 2 * 1024 * 1024, data, 1); |
2304 | if (ret < 0) | ||
2305 | break; | ||
2306 | down_read(&space_info->groups_sem); | 2304 | down_read(&space_info->groups_sem); |
2305 | if (ret < 0) | ||
2306 | goto loop_check; | ||
2307 | head = &space_info->block_groups; | 2307 | head = &space_info->block_groups; |
2308 | /* | 2308 | /* |
2309 | * we've allocated a new chunk, keep | 2309 | * we've allocated a new chunk, keep |
@@ -2314,6 +2314,7 @@ new_group_no_lock: | |||
2314 | } else if (!allowed_chunk_alloc) { | 2314 | } else if (!allowed_chunk_alloc) { |
2315 | space_info->force_alloc = 1; | 2315 | space_info->force_alloc = 1; |
2316 | } | 2316 | } |
2317 | loop_check: | ||
2317 | if (keep_going) { | 2318 | if (keep_going) { |
2318 | cur = head->next; | 2319 | cur = head->next; |
2319 | extra_loop = 0; | 2320 | extra_loop = 0; |