ctdb-locking: Log if ctdb is unable to take db locks in INACTIVE state
authorAmitay Isaacs <amitay@gmail.com>
Thu, 22 Sep 2016 03:58:06 +0000 (13:58 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 22 Sep 2016 06:34:20 +0000 (08:34 +0200)
This is useful information if ctdb is unable to freeze any of the
databases on banning or stopping.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_lock.c

index 405a29e55739eb43c453ee712bf6ad9a73a84a60..46498e079ef95fffc9e9fdf3354bee1ee1d99732 100644 (file)
@@ -401,12 +401,6 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev,
        lock_ctx = talloc_get_type_abort(private_data, struct lock_context);
        ctdb = lock_ctx->ctdb;
 
-       /* If a node stopped/banned, don't spam the logs */
-       if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_INACTIVE) {
-               lock_ctx->ttimer = NULL;
-               return;
-       }
-
        elapsed_time = timeval_elapsed(&lock_ctx->start_time);
        if (lock_ctx->ctdb_db) {
                DEBUG(DEBUG_WARNING,
@@ -419,6 +413,11 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev,
                       elapsed_time));
        }
 
+       /* If a node stopped/banned, don't spam the logs */
+       if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_INACTIVE) {
+               goto skip_lock_debug;
+       }
+
        if (ctdb_set_helper("lock debugging helper",
                            debug_locks, sizeof(debug_locks),
                            "CTDB_DEBUG_LOCKS",
@@ -435,6 +434,8 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev,
                       " Unable to setup lock debugging\n"));
        }
 
+skip_lock_debug:
+
        /* Back-off logging if lock is not obtained for a long time */
        if (elapsed_time < 100.0) {
                new_timer = 10;