aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-10-15 16:14:48 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:56 -0400
commitf510cfecfc98759d75283823cfccf0cc0d59a4c6 (patch)
treedfc2f788df4e2a437d976f78a2a2a675375f7134 /fs/btrfs/ctree.c
parentae5252bd51a252b7b8b02289337c36774835101c (diff)
Btrfs: Fix extent_buffer and extent_state leaks
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 9427b79c5d79..50ef351ef6b3 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -87,6 +87,7 @@ static int __btrfs_cow_block(struct btrfs_trans_handle *trans,
87 if (IS_ERR(cow)) 87 if (IS_ERR(cow))
88 return PTR_ERR(cow); 88 return PTR_ERR(cow);
89 89
90 cow->alloc_addr = (unsigned long)__builtin_return_address(0);
90 if (buf->len != root->sectorsize || cow->len != root->sectorsize) 91 if (buf->len != root->sectorsize || cow->len != root->sectorsize)
91 WARN_ON(1); 92 WARN_ON(1);
92 93
@@ -132,6 +133,7 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans,
132 struct extent_buffer **cow_ret) 133 struct extent_buffer **cow_ret)
133{ 134{
134 u64 search_start; 135 u64 search_start;
136 int ret;
135 if (trans->transaction != root->fs_info->running_transaction) { 137 if (trans->transaction != root->fs_info->running_transaction) {
136 printk(KERN_CRIT "trans %Lu running %Lu\n", trans->transid, 138 printk(KERN_CRIT "trans %Lu running %Lu\n", trans->transid,
137 root->fs_info->running_transaction->transid); 139 root->fs_info->running_transaction->transid);
@@ -148,8 +150,10 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans,
148 } 150 }
149 151
150 search_start = extent_buffer_blocknr(buf) & ~((u64)65535); 152 search_start = extent_buffer_blocknr(buf) & ~((u64)65535);
151 return __btrfs_cow_block(trans, root, buf, parent, 153 ret = __btrfs_cow_block(trans, root, buf, parent,
152 parent_slot, cow_ret, search_start, 0); 154 parent_slot, cow_ret, search_start, 0);
155 (*cow_ret)->alloc_addr = (unsigned long)__builtin_return_address(0);
156 return ret;
153} 157}
154 158
155static int close_blocks(u64 blocknr, u64 other) 159static int close_blocks(u64 blocknr, u64 other)
@@ -1013,8 +1017,10 @@ again:
1013 if (sret) 1017 if (sret)
1014 return sret; 1018 return sret;
1015 b = p->nodes[level]; 1019 b = p->nodes[level];
1016 if (!b) 1020 if (!b) {
1021 btrfs_release_path(NULL, p);
1017 goto again; 1022 goto again;
1023 }
1018 slot = p->slots[level]; 1024 slot = p->slots[level];
1019 BUG_ON(btrfs_header_nritems(b) == 1); 1025 BUG_ON(btrfs_header_nritems(b) == 1);
1020 } 1026 }