diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-11-08 16:59:05 +0100 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 17:03:57 +0200 |
commit | 856bf3e592f917e7d663cb7fa93e83fe795e8f4e (patch) | |
tree | 0f781a0b06bf0e86b49665b820bcce4be5b7a9fa /fs/btrfs/extent_map.c | |
parent | Btrfs: Allow large data extents in a single file to span into metadata block ... (diff) | |
download | linux-856bf3e592f917e7d663cb7fa93e83fe795e8f4e.tar.xz linux-856bf3e592f917e7d663cb7fa93e83fe795e8f4e.zip |
Btrfs: Avoid extent_buffer lru corruption
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-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) rm = list_entry(tree->buffer_lru.prev, struct extent_buffer, lru); tree->lru_size--; - list_del(&rm->lru); + list_del_init(&rm->lru); free_extent_buffer(rm); } } else @@ -2187,6 +2187,9 @@ lru_add: return eb; fail: + spin_lock(&tree->lru_lock); + list_del_init(&eb->lru); + spin_unlock(&tree->lru_lock); if (!atomic_dec_and_test(&eb->refs)) return NULL; for (index = 0; index < i; index++) { @@ -2246,6 +2249,9 @@ lru_add: spin_unlock(&tree->lru_lock); return eb; fail: + spin_lock(&tree->lru_lock); + list_del_init(&eb->lru); + spin_unlock(&tree->lru_lock); if (!atomic_dec_and_test(&eb->refs)) return NULL; for (index = 0; index < i; index++) { |