aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index fadf69a2764b..dc84daee6bc4 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -267,7 +267,7 @@ static int caching_kthread(void *data)
267 last = max_t(u64, block_group->key.objectid, BTRFS_SUPER_INFO_OFFSET); 267 last = max_t(u64, block_group->key.objectid, BTRFS_SUPER_INFO_OFFSET);
268again: 268again:
269 /* need to make sure the commit_root doesn't disappear */ 269 /* need to make sure the commit_root doesn't disappear */
270 down_read(&fs_info->extent_root->commit_root_sem); 270 down_read(&fs_info->extent_commit_sem);
271 271
272 /* 272 /*
273 * We don't want to deadlock with somebody trying to allocate a new 273 * We don't want to deadlock with somebody trying to allocate a new
@@ -302,10 +302,11 @@ again:
302 else if (ret) 302 else if (ret)
303 break; 303 break;
304 304
305 if (need_resched()) { 305 if (need_resched() ||
306 btrfs_transaction_in_commit(fs_info)) {
306 btrfs_release_path(fs_info->extent_root, path); 307 btrfs_release_path(fs_info->extent_root, path);
307 up_read(&fs_info->extent_root->commit_root_sem); 308 up_read(&fs_info->extent_commit_sem);
308 cond_resched(); 309 schedule_timeout(1);
309 goto again; 310 goto again;
310 } 311 }
311 312
@@ -345,7 +346,7 @@ next:
345 346
346err: 347err:
347 btrfs_free_path(path); 348 btrfs_free_path(path);
348 up_read(&fs_info->extent_root->commit_root_sem); 349 up_read(&fs_info->extent_commit_sem);
349 atomic_dec(&block_group->space_info->caching_threads); 350 atomic_dec(&block_group->space_info->caching_threads);
350 wake_up(&block_group->caching_q); 351 wake_up(&block_group->caching_q);
351 352