MDEV-24671, lock_sys.wait_mutex was moved above lock_sys.mutex (which was later replaced with lock_sys.latch) in the latching order. In MDEV-24789, a potential hang was introduced to Galera. The function lock_wait() would hold lock_sys.wait_mutex while invoking wsrep_is_BF_lock_timeout(), which in turn could acquire LockMutexGuard for some diagnostic printout.
According to Jan Lindström, we can remove that printout.
To catch similar latching order violation in the future, we will add debug checks around lock_sys.latch acquisition. Unfortunately, RW-locks are not covered by SAFE_MUTEX.