Testing node->down requires the tree lock to be held.
In decrement_reference only test node->down if the tree lock is held. As node->down is not always tested in decrement_reference we need to test that it is non NULL in cleanup_dead_nodes prior to removing the node from the rbt tree. Additionally it is not always possible to aquire the node lock and reactivate a node when adding parent nodes. Reactivate such nodes in cleanup_dead_nodes if required.
Showing with 22 additions and 5 deletions