Skip to content

Improve the reference counting in newref()

Ondřej Surý requested to merge ondrej/improve-newref-checks into main

In qpcache (and rbtdb), there are some functions that don't acquire neither the tree lock nor the node lock when calling newref(). In theory, this could lead to a new reference to a node that's just going to be deleted. As the delete_node() is always protected by both the tree and the node lock write-locked, improve the logic to require either the tree or the node lock to be at least read locked when incrementing unreferenced node (the reference is zero before the increment).

Merge request reports