]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-daemon: Remove helper variable CTDB_LOCK_HELPER
authorMartin Schwenke <mschwenke@ddn.com>
Thu, 30 Oct 2025 10:55:50 +0000 (21:55 +1100)
committerVolker Lendecke <vl@samba.org>
Wed, 25 Feb 2026 12:33:39 +0000 (12:33 +0000)
Replace with a lock_helper member in ctdb_context, set using
path_helperdir_append().

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
ctdb/tests/local_daemons.sh

index 6bf8141be6d72aa8d9a217d5124b66e998d4a8e9..66f29a85f2329626923e05c2827c367f5074af1a 100644 (file)
@@ -333,6 +333,7 @@ struct ctdb_context {
        struct trbt_tree *child_processes; 
 
        /* Used for locking record/db/alldb */
+       const char *lock_helper;
        struct lock_context *lock_current;
        struct lock_context *lock_pending;
 };
index 4231313b65445f7bad72b62a4b993b90133f9479..1ee3a1e4e96cc57db4ae68e7376fe3ec6a7fc134 100644 (file)
@@ -706,17 +706,8 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
        struct lock_context *lock_ctx;
        int ret;
        TALLOC_CTX *tmp_ctx;
-       static char prog[PATH_MAX+1] = "";
        char **args = NULL;
 
-       if (!ctdb_set_helper("lock helper",
-                            prog, sizeof(prog),
-                            "CTDB_LOCK_HELPER",
-                            CTDB_HELPER_BINDIR, "ctdb_lock_helper")) {
-               ctdb_die(ctdb, __location__
-                        " Unable to set lock helper\n");
-       }
-
        /* Find a lock context with requests */
        lock_ctx = ctdb_find_lock_context(ctdb);
        if (lock_ctx == NULL) {
@@ -761,7 +752,7 @@ static void ctdb_lock_schedule(struct ctdb_context *ctdb)
 
        lock_ctx->child = ctdb_vfork_exec(lock_ctx,
                                          ctdb,
-                                         prog,
+                                         ctdb->lock_helper,
                                          talloc_array_length(args),
                                          (const char *const *)args);
        if (lock_ctx->child == -1) {
index d4cfe341275bf9b2a89671a1270279da4906bdf6..06cdae8f50d30de9b876c6a7713298a6ddb25bc8 100644 (file)
@@ -109,6 +109,13 @@ static struct ctdb_context *ctdb_init(struct tevent_context *ev)
                return NULL;
        }
 
+       ctdb->lock_helper = path_helperdir_append(ctdb, "ctdb_lock_helper");
+       if (ctdb->lock_helper == NULL) {
+               DBG_ERR("Memory allocation error\n");
+               talloc_free(ctdb);
+               return NULL;
+       }
+
        ctdbd_pidfile = path_pidfile(ctdb, "ctdbd");
        if (ctdbd_pidfile == NULL) {
                DBG_ERR("Memory allocation error\n");
index 4402ee351f632dab405d76720b80e86ed0d9b9da..c712b5e140c4e1cca8ec68bdc9e57743b4637e41 100755 (executable)
@@ -15,7 +15,6 @@ export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts"
 
 if ! $CTDB_TESTS_ARE_INSTALLED; then
        hdir="$CTDB_SCRIPTS_HELPER_BINDIR"
-       export CTDB_LOCK_HELPER="${hdir}/ctdb_lock_helper"
        export CTDB_CLUSTER_MUTEX_HELPER="${hdir}/ctdb_mutex_fcntl_helper"
 fi