diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent_io.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 0381b6007ae4..0f74262911be 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -3750,7 +3750,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, | |||
3750 | } | 3750 | } |
3751 | if (uptodate) | 3751 | if (uptodate) |
3752 | set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); | 3752 | set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); |
3753 | 3753 | again: | |
3754 | ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM); | 3754 | ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM); |
3755 | if (ret) | 3755 | if (ret) |
3756 | goto free_eb; | 3756 | goto free_eb; |
@@ -3760,7 +3760,13 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, | |||
3760 | if (ret == -EEXIST) { | 3760 | if (ret == -EEXIST) { |
3761 | exists = radix_tree_lookup(&tree->buffer, | 3761 | exists = radix_tree_lookup(&tree->buffer, |
3762 | start >> PAGE_CACHE_SHIFT); | 3762 | start >> PAGE_CACHE_SHIFT); |
3763 | atomic_inc(&exists->refs); | 3763 | if (!atomic_inc_not_zero(&exists->refs)) { |
3764 | spin_unlock(&tree->buffer_lock); | ||
3765 | radix_tree_preload_end(); | ||
3766 | synchronize_rcu(); | ||
3767 | exists = NULL; | ||
3768 | goto again; | ||
3769 | } | ||
3764 | spin_unlock(&tree->buffer_lock); | 3770 | spin_unlock(&tree->buffer_lock); |
3765 | radix_tree_preload_end(); | 3771 | radix_tree_preload_end(); |
3766 | goto free_eb; | 3772 | goto free_eb; |