diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-11-08 10:59:05 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:57 -0400 |
commit | 856bf3e592f917e7d663cb7fa93e83fe795e8f4e (patch) | |
tree | 0f781a0b06bf0e86b49665b820bcce4be5b7a9fa /fs/btrfs | |
parent | 257d0ce36f215937602eb5c1b328b69afaf3bcd8 (diff) |
Btrfs: Avoid extent_buffer lru corruption
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/extent_map.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index c976615dcda3..754bc42c162a 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -2047,7 +2047,7 @@ static int add_lru(struct extent_map_tree *tree, struct extent_buffer *eb) | |||
2047 | rm = list_entry(tree->buffer_lru.prev, | 2047 | rm = list_entry(tree->buffer_lru.prev, |
2048 | struct extent_buffer, lru); | 2048 | struct extent_buffer, lru); |
2049 | tree->lru_size--; | 2049 | tree->lru_size--; |
2050 | list_del(&rm->lru); | 2050 | list_del_init(&rm->lru); |
2051 | free_extent_buffer(rm); | 2051 | free_extent_buffer(rm); |
2052 | } | 2052 | } |
2053 | } else | 2053 | } else |
@@ -2187,6 +2187,9 @@ lru_add: | |||
2187 | return eb; | 2187 | return eb; |
2188 | 2188 | ||
2189 | fail: | 2189 | fail: |
2190 | spin_lock(&tree->lru_lock); | ||
2191 | list_del_init(&eb->lru); | ||
2192 | spin_unlock(&tree->lru_lock); | ||
2190 | if (!atomic_dec_and_test(&eb->refs)) | 2193 | if (!atomic_dec_and_test(&eb->refs)) |
2191 | return NULL; | 2194 | return NULL; |
2192 | for (index = 0; index < i; index++) { | 2195 | for (index = 0; index < i; index++) { |
@@ -2246,6 +2249,9 @@ lru_add: | |||
2246 | spin_unlock(&tree->lru_lock); | 2249 | spin_unlock(&tree->lru_lock); |
2247 | return eb; | 2250 | return eb; |
2248 | fail: | 2251 | fail: |
2252 | spin_lock(&tree->lru_lock); | ||
2253 | list_del_init(&eb->lru); | ||
2254 | spin_unlock(&tree->lru_lock); | ||
2249 | if (!atomic_dec_and_test(&eb->refs)) | 2255 | if (!atomic_dec_and_test(&eb->refs)) |
2250 | return NULL; | 2256 | return NULL; |
2251 | for (index = 0; index < i; index++) { | 2257 | for (index = 0; index < i; index++) { |