Commit 85d0fbf7 authored by Yan, Zheng's avatar Yan, Zheng Committed by Greg Kroah-Hartman

Btrfs: fix race between allocate and release extent buffer.

commit f044ba78 upstream.

Increase extent buffer's reference count while holding the lock.
Otherwise it can race with try_release_extent_buffer.
Signed-off-by: default avatarYan Zheng <zheng.yan@oracle.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
Acked-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 95ec1a91
......@@ -3165,10 +3165,9 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
spin_unlock(&tree->buffer_lock);
goto free_eb;
}
spin_unlock(&tree->buffer_lock);
/* add one reference for the tree */
atomic_inc(&eb->refs);
spin_unlock(&tree->buffer_lock);
return eb;
free_eb:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment