Allocation of metadata is protected by the per-cld Metaspace lock.
The allocation paths always take the Metaspace locks with _no_safepoint_check_flag.
De-allocation of metadata is similarly protected by the per-cld Metaspace lock.
However de-allocations use a normal MutexLocker and thereby a different code path in Mutex.
I believe this was safe until recently because we only deallocated metadata from the VM thread while safepointed but with the MethodCounters change we can now end up deallocating metadata while the VM is running.