diff options
author | Amitay Isaacs <amitay@gmail.com> | 2016-09-22 14:06:44 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2016-09-22 08:34:20 +0200 |
commit | 8b979c729b66c8a9c3eeff971ad5e34415ed44d7 (patch) | |
tree | 872af67bd32f91cfe4bd911264bc198c374bca54 /ctdb/server/ctdb_lock.c | |
parent | cdc46ef9d72b0beb8696c8b6f7c3c40768834045 (diff) | |
download | samba-8b979c729b66c8a9c3eeff971ad5e34415ed44d7.tar.gz |
ctdb-locking: Restrict lock debugging to once per second
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb/server/ctdb_lock.c')
-rw-r--r-- | ctdb/server/ctdb_lock.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c index 46498e079ef..3a58711bc4b 100644 --- a/ctdb/server/ctdb_lock.c +++ b/ctdb/server/ctdb_lock.c @@ -392,8 +392,10 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev, void *private_data) { static char debug_locks[PATH_MAX+1] = ""; + static struct timeval last_debug_time; struct lock_context *lock_ctx; struct ctdb_context *ctdb; + struct timeval now; pid_t pid; double elapsed_time; int new_timer; @@ -418,6 +420,14 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev, goto skip_lock_debug; } + /* Restrict log debugging to once per second */ + now = timeval_current(); + if (last_debug_time.tv_sec == now.tv_sec) { + goto skip_lock_debug; + } + + last_debug_time.tv_sec = now.tv_sec; + if (ctdb_set_helper("lock debugging helper", debug_locks, sizeof(debug_locks), "CTDB_DEBUG_LOCKS", |