Skip to content

Commit 1e1c50a

Browse files
lorddoskiaskdave
authored andcommitted
btrfs: Fix possible softlock on single core machines
do_chunk_alloc implements a loop checking whether there is a pending chunk allocation and if so causes the caller do loop. Generally this loop is executed only once, however testing with btrfs/072 on a single core vm machines uncovered an extreme case where the system could loop indefinitely. This is due to a missing cond_resched when loop which doesn't give a chance to the previous chunk allocator finish its job. The fix is to simply add the missing cond_resched. Fixes: 6d74119 ("Btrfs: avoid taking the chunk_mutex in do_chunk_alloc") Signed-off-by: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent b98def7 commit 1e1c50a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/extent-tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4643,6 +4643,7 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,
46434643
if (wait_for_alloc) {
46444644
mutex_unlock(&fs_info->chunk_mutex);
46454645
wait_for_alloc = 0;
4646+
cond_resched();
46464647
goto again;
46474648
}
46484649

0 commit comments

Comments
 (0)