diff options
author | Yan, Zheng <zheng.yan@oracle.com> | 2010-02-04 03:46:56 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-02-04 11:31:44 -0500 |
commit | f044ba7835b84e69c68b620ca8fa27e5ef67759d (patch) | |
tree | 33c21a5b97a61d584f330618c7428d513e5d8aa2 /fs/btrfs | |
parent | 035fe03a7ad56982b30ab3a522b7b08d58feccd0 (diff) |
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: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/extent_io.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 96577e8bf9fd..b177ed319612 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -3165,10 +3165,9 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, | |||
3165 | spin_unlock(&tree->buffer_lock); | 3165 | spin_unlock(&tree->buffer_lock); |
3166 | goto free_eb; | 3166 | goto free_eb; |
3167 | } | 3167 | } |
3168 | spin_unlock(&tree->buffer_lock); | ||
3169 | |||
3170 | /* add one reference for the tree */ | 3168 | /* add one reference for the tree */ |
3171 | atomic_inc(&eb->refs); | 3169 | atomic_inc(&eb->refs); |
3170 | spin_unlock(&tree->buffer_lock); | ||
3172 | return eb; | 3171 | return eb; |
3173 | 3172 | ||
3174 | free_eb: | 3173 | free_eb: |