Refactor locks in DirMgr.
The DirMgr
object has a bunch of locked and/or atomic fields: which makes it hard to ensure that the locks are used in a proper hierararchy.
See @Diziet's comments on !587 (comment 2813083) .
We should fix this, possibly by merging locks, possibly by documenting more, and possibly by splitting objects.