From ae046a2e38cb07eb61c6dae62c3dd2011b8541d1 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sun, 8 Mar 2026 14:58:47 +0100 Subject: [PATCH] =?UTF-8?q?Add=20lock=20ordering=20assertions=20for=20psql?= =?UTF-8?q?=5Flock=20=E2=86=92=20file=20mutex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pclsync/pfs.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pclsync/pfs.h b/pclsync/pfs.h index db14a3b..ae11a30 100644 --- a/pclsync/pfs.h +++ b/pclsync/pfs.h @@ -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);