diff options
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 9d89c1648e8e..1bcfcdb23cf4 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -2769,9 +2769,13 @@ again: | |||
2769 | * the commit roots are read only | 2769 | * the commit roots are read only |
2770 | * so we always do read locks | 2770 | * so we always do read locks |
2771 | */ | 2771 | */ |
2772 | if (p->need_commit_sem) | ||
2773 | down_read(&root->fs_info->commit_root_sem); | ||
2772 | b = root->commit_root; | 2774 | b = root->commit_root; |
2773 | extent_buffer_get(b); | 2775 | extent_buffer_get(b); |
2774 | level = btrfs_header_level(b); | 2776 | level = btrfs_header_level(b); |
2777 | if (p->need_commit_sem) | ||
2778 | up_read(&root->fs_info->commit_root_sem); | ||
2775 | if (!p->skip_locking) | 2779 | if (!p->skip_locking) |
2776 | btrfs_tree_read_lock(b); | 2780 | btrfs_tree_read_lock(b); |
2777 | } else { | 2781 | } else { |
@@ -5436,6 +5440,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root, | |||
5436 | * the right if possible or go up and right. | 5440 | * the right if possible or go up and right. |
5437 | */ | 5441 | */ |
5438 | 5442 | ||
5443 | down_read(&left_root->fs_info->commit_root_sem); | ||
5439 | left_level = btrfs_header_level(left_root->commit_root); | 5444 | left_level = btrfs_header_level(left_root->commit_root); |
5440 | left_root_level = left_level; | 5445 | left_root_level = left_level; |
5441 | left_path->nodes[left_level] = left_root->commit_root; | 5446 | left_path->nodes[left_level] = left_root->commit_root; |
@@ -5445,6 +5450,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root, | |||
5445 | right_root_level = right_level; | 5450 | right_root_level = right_level; |
5446 | right_path->nodes[right_level] = right_root->commit_root; | 5451 | right_path->nodes[right_level] = right_root->commit_root; |
5447 | extent_buffer_get(right_path->nodes[right_level]); | 5452 | extent_buffer_get(right_path->nodes[right_level]); |
5453 | up_read(&left_root->fs_info->commit_root_sem); | ||
5448 | 5454 | ||
5449 | if (left_level == 0) | 5455 | if (left_level == 0) |
5450 | btrfs_item_key_to_cpu(left_path->nodes[left_level], | 5456 | btrfs_item_key_to_cpu(left_path->nodes[left_level], |