Add lock ordering assertions for psql_lock → file mutex

This commit is contained in:
Levi Neely 2026-03-08 14:58:47 +01:00
parent d0c213f181
commit ae046a2e38
1 changed files with 4 additions and 0 deletions

View File

@ -145,6 +145,10 @@ typedef struct {
extern PSYNC_THREAD const char *psync_thread_name;
static inline int pfs_do_lock_file(psync_openfile_t *of, const char *file,
unsigned long line) {
if (!psql_locked()) {
pdbg_logf(D_ERROR, "lock ordering violation: pfs_lock_file called without psql_lock at %s:%lu", file, line);
abort();
}
if (unlikely(pthread_mutex_trylock(&of->mutex))) {
struct timespec tm;
clock_gettime(CLOCK_REALTIME, &tm);