diff options
author | Martin Schwenke <martin@meltin.net> | 2013-10-01 15:13:29 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2013-10-22 15:37:54 +1100 |
commit | 463a091a7778211a29331d0d4e34b3d5b16e73cb (patch) | |
tree | edf54fb8a8dd91351cc4a7476a7c51bcf7f04e64 /ctdb/server/ctdb_lock.c | |
parent | 4adc8f4f09bc2d32307917cc632d7d8c0b63e975 (diff) | |
download | samba-463a091a7778211a29331d0d4e34b3d5b16e73cb.tar.gz samba-463a091a7778211a29331d0d4e34b3d5b16e73cb.tar.xz samba-463a091a7778211a29331d0d4e34b3d5b16e73cb.zip |
ctdbd: Debug locks by default with override from enviroment variable
Default is debug_locks.sh, relative to CTDB_BASE.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit c11803e3dcc905a45a08d743595e63f9ca445f0d)
Diffstat (limited to 'ctdb/server/ctdb_lock.c')
-rw-r--r-- | ctdb/server/ctdb_lock.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c index 1d27a444b66..fc437b0fa7f 100644 --- a/ctdb/server/ctdb_lock.c +++ b/ctdb/server/ctdb_lock.c @@ -495,7 +495,7 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev, struct timeval current_time, void *private_data) { - const char *cmd = getenv("CTDB_DEBUG_LOCKS"); + static const char * debug_locks = NULL; struct lock_context *lock_ctx; struct ctdb_context *ctdb; pid_t pid; @@ -515,12 +515,24 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev, timeval_elapsed(&lock_ctx->start_time))); } - /* fire a child process to find the blocking process */ - if (cmd != NULL) { + /* Fire a child process to find the blocking process. */ + if (debug_locks == NULL) { + debug_locks = getenv("CTDB_DEBUG_LOCKS"); + if (debug_locks == NULL) { + debug_locks = talloc_asprintf(ctdb, + "%s/debug_locks.sh", + getenv("CTDB_BASE")); + } + } + if (debug_locks != NULL) { pid = fork(); if (pid == 0) { - execl(cmd, cmd, NULL); + execl(debug_locks, debug_locks, NULL); } + } else { + DEBUG(DEBUG_WARNING, + (__location__ + " Unable to setup lock debugging - no memory?\n")); } /* reset the timeout timer */ |