Draft: [9.18] De-duplicate the removal logic from cleanup_dead_nodes()
Instead of implementing the removal logic in the cleanup_dead_nodes(), increment and decrement the reference again, and let the decref() handle the deletions. We now hold both write locks, so the item will not be re-added to the deadnodes list.
As added bonus - this removes the possibility of removing and adding a rbt node to the deadnodes again and again when it has a new child since it was added to the deadnodes list.
Backport of !8817 (closed)
Edited by Ondřej Surý