提交 f044ba78 编写于 作者: Y Yan, Zheng 提交者: Chris Mason

Btrfs: fix race between allocate and release extent buffer.

Increase extent buffer's reference count while holding the lock.
Otherwise it can race with try_release_extent_buffer.
Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 035fe03a
...@@ -3165,10 +3165,9 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, ...@@ -3165,10 +3165,9 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
spin_unlock(&tree->buffer_lock); spin_unlock(&tree->buffer_lock);
goto free_eb; goto free_eb;
} }
spin_unlock(&tree->buffer_lock);
/* add one reference for the tree */ /* add one reference for the tree */
atomic_inc(&eb->refs); atomic_inc(&eb->refs);
spin_unlock(&tree->buffer_lock);
return eb; return eb;
free_eb: free_eb:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册