Fix debug build conditional compilation for lock ordering assertions
This commit is contained in:
parent
e8b90aa8bb
commit
fb29883584
|
|
@ -45,3 +45,10 @@ void pfs_debug_register_signal_handlers() {
|
|||
sa.sa_flags = 0;
|
||||
sigaction(SIGUSR1, &sa, NULL);
|
||||
}
|
||||
|
||||
void pfs_debug_check_lock_order(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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ __attribute__((weak)) void pfs_debug_init_file_mutex(pthread_mutex_t *m) {
|
|||
}
|
||||
__attribute__((weak)) void pfs_debug_dump_internals() {}
|
||||
__attribute__((weak)) void pfs_debug_register_signal_handlers() {}
|
||||
__attribute__((weak)) void pfs_debug_check_lock_order(const char *file, unsigned long line) {}
|
||||
|
||||
static int pfs_ftruncate_of_locked(psync_openfile_t *of, fuse_off_t size);
|
||||
|
||||
|
|
|
|||
|
|
@ -146,10 +146,7 @@ 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();
|
||||
}
|
||||
pfs_debug_check_lock_order(file, line);
|
||||
if (unlikely(pthread_mutex_trylock(&of->mutex))) {
|
||||
struct timespec tm;
|
||||
clock_gettime(CLOCK_REALTIME, &tm);
|
||||
|
|
@ -201,6 +198,7 @@ void pfs_clean_tasks();
|
|||
void pfs_debug_init_file_mutex(pthread_mutex_t *m);
|
||||
void pfs_debug_dump_internals();
|
||||
void pfs_debug_register_signal_handlers();
|
||||
void pfs_debug_check_lock_order(const char *file, unsigned long line);
|
||||
|
||||
extern volatile sig_atomic_t shutdown_requested;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue