]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-daemon: Remove helper variable CTDB_DEBUG_LOCKS
authorMartin Schwenke <mschwenke@ddn.com>
Fri, 31 Oct 2025 03:48:23 +0000 (14:48 +1100)
committerVolker Lendecke <vl@samba.org>
Wed, 25 Feb 2026 12:33:39 +0000 (12:33 +0000)
Replace with a lock_debug_script member in ctdb_context.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
ctdb/include/ctdb_private.h
ctdb/server/ctdb_lock.c
ctdb/server/ctdbd.c

index 66f29a85f2329626923e05c2827c367f5074af1a..a79c466c1778a296388aa15afbbe08e66e7bfb7e 100644 (file)
@@ -334,6 +334,7 @@ struct ctdb_context {
 
        /* Used for locking record/db/alldb */
        const char *lock_helper;
+       const char *lock_debug_script;
        struct lock_context *lock_current;
        struct lock_context *lock_pending;
 };
index 1ee3a1e4e96cc57db4ae68e7376fe3ec6a7fc134..b0fe75e8eeaf0de657dd91523c67dd5d5baff743 100644 (file)
@@ -524,7 +524,6 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev,
                                    struct timeval current_time,
                                    void *private_data)
 {
-       static char debug_locks[PATH_MAX+1] = "";
        struct lock_context *lock_ctx;
        struct ctdb_context *ctdb;
        pid_t pid;
@@ -532,7 +531,6 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev,
        bool skip;
        char *keystr;
        char **args;
-       bool ok;
 
        lock_ctx = talloc_get_type_abort(private_data, struct lock_context);
        ctdb = lock_ctx->ctdb;
@@ -570,15 +568,7 @@ static void ctdb_lock_timeout_handler(struct tevent_context *ev,
        }
 
 lock_debug:
-
-       ok = ctdb_set_helper("lock debugging helper",
-                            debug_locks,
-                            sizeof(debug_locks),
-                            "CTDB_DEBUG_LOCKS",
-                            getenv("CTDB_BASE"),
-                            "debug_locks.sh");
-       if (!ok) {
-               DBG_WARNING("Unable to setup lock debugging\n");
+       if (ctdb->lock_debug_script == NULL) {
                goto skip_lock_debug;
        }
 
@@ -586,7 +576,7 @@ lock_debug:
        if (args != NULL) {
                pid = vfork();
                if (pid == 0) {
-                       execvp(debug_locks, args);
+                       execvp(ctdb->lock_debug_script, args);
                        _exit(0);
                }
                talloc_free(args);
index 06cdae8f50d30de9b876c6a7713298a6ddb25bc8..63141fd1385b480f8fa1b890db68e7ab8a0d5e81 100644 (file)
@@ -350,13 +350,12 @@ int main(int argc, const char *argv[])
                goto fail;
        }
 
-       if (ctdb_config.lock_debug_script != NULL) {
-               ret = setenv("CTDB_DEBUG_LOCKS",
-                            ctdb_config.lock_debug_script,
-                            1);
-               if (ret != 0) {
-                       D_ERR("Failed to set up lock debugging (%s)\n",
-                             strerror(errno));
+       ctdb->lock_debug_script = ctdb_config.lock_debug_script;
+       if (ctdb->lock_debug_script == NULL) {
+               ctdb->lock_debug_script = path_etcdir_append(ctdb,
+                                                            "debug_locks.sh");
+               if (ctdb->lock_debug_script == NULL) {
+                       DBG_ERR("No memory for lock debugging script path\n");
                        goto fail;
                }
        }