]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Fix possible softlock on single core machines
authorNikolay Borisov <nborisov@suse.com>
Thu, 5 Apr 2018 07:40:15 +0000 (10:40 +0300)
committerDavid Sterba <dsterba@suse.com>
Thu, 5 Apr 2018 17:22:35 +0000 (19:22 +0200)
commit9f7699ec090dec4cb498dd7bff10ce28b3ccc6f2
tree1e950e1030b25534acc205832c6eae3b05aee1b4
parent6728efc77b21d9c3dceb59e1a6c180eb6b3237ba
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: 15c2297dcdc1 ("Btrfs: avoid taking the chunk_mutex in do_chunk_alloc")
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c