Skip to content

Commit

Permalink
btrfs: send: remove BUG_ON from name_cache_delete
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Sterba authored and Josef Bacik committed Mar 10, 2014
1 parent 4d1a63b commit 57fb891
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fs/btrfs/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 57fb891

Please sign in to comment.