If we have an error while building the backref tree in relocation we'll process all the pending edges and then free the node. This isn't quite right however as the node could be integrated into the existing cache partially, linking children within itself into the cache, but not properly linked into the cache itself. The fix for this is simple, use remove_backref_node() instead of free_backref_node(), which will clean up the cache related to this node completely. Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx> --- fs/btrfs/relocation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 4fb7e3cc2aca..507361e99316 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1244,7 +1244,7 @@ struct backref_node *build_backref_tree(struct reloc_control *rc, free_backref_node(cache, lower); } - free_backref_node(cache, node); + remove_backref_node(cache, node); return ERR_PTR(err); } ASSERT(!node || !node->detached); -- 2.24.1
