[entropy.locks] fix shared/exclusive locking mix due to reentrancy, add tests