summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-02-03 19:24:40 +0100
committerJosef Bacik <jbacik@fb.com>2014-03-10 15:15:48 -0400
commit57fb8910c24004ec924103c9a8c8542119f7629a (patch)
tree1e9878f43b4abee9d468633055c568f2bf3d72d1
parent4d1a63b21b4f77a82efe7d78fc1ae1cc7532691c (diff)
btrfs: send: remove BUG_ON from name_cache_delete
If cleaning the name cache fails, we could try to proceed at the cost of some memory leak. This is not expected to happen often. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fb.com>
-rw-r--r--fs/btrfs/send.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index d3ed9df77422..bef7ba638dee 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1890,13 +1890,20 @@ static void name_cache_delete(struct send_ctx *sctx,
nce_head = radix_tree_lookup(&sctx->name_cache,
(unsigned long)nce->ino);
- BUG_ON(!nce_head);
+ if (!nce_head) {
+ btrfs_err(sctx->send_root->fs_info,
+ "name_cache_delete lookup failed ino %llu cache size %d, leaking memory",
+ nce->ino, sctx->name_cache_size);
+ }
list_del(&nce->radix_list);
list_del(&nce->list);
sctx->name_cache_size--;
- if (list_empty(nce_head)) {
+ /*
+ * We may not get to the final release of nce_head if the lookup fails
+ */
+ if (nce_head && list_empty(nce_head)) {
radix_tree_delete(&sctx->name_cache, (unsigned long)nce->ino);
kfree(nce_head);
}