diff --git a/source3/lib/ctdb_dummy.c b/source3/lib/ctdb_dummy.c index 0e061becbc2..ec0bcc45bcb 100644 --- a/source3/lib/ctdb_dummy.c +++ b/source3/lib/ctdb_dummy.c @@ -64,6 +64,7 @@ bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn, pid_t pid } struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, + struct messaging_context *msg_ctx, struct ctdbd_connection *conn, const char *name, int hash_size, int tdb_flags, diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index cf039843668..ea76abcd046 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -1578,6 +1578,7 @@ static size_t db_ctdb_id(struct db_context *db, uint8_t *id, size_t idlen) } struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, + struct messaging_context *msg_ctx, struct ctdbd_connection *conn, const char *name, int hash_size, int tdb_flags, @@ -1703,8 +1704,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, } if (result->persistent) { - db_ctdb->lock_ctx = g_lock_ctx_init( - db_ctdb, ctdb_conn_msg_ctx(db_ctdb->conn)); + db_ctdb->lock_ctx = g_lock_ctx_init(db_ctdb, msg_ctx); if (db_ctdb->lock_ctx == NULL) { DEBUG(0, ("g_lock_ctx_init failed\n")); TALLOC_FREE(result); diff --git a/source3/lib/dbwrap/dbwrap_ctdb.h b/source3/lib/dbwrap/dbwrap_ctdb.h index 2e4b93ce003..3f047020abb 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.h +++ b/source3/lib/dbwrap/dbwrap_ctdb.h @@ -29,6 +29,7 @@ struct db_context; struct ctdbd_connection; struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, + struct messaging_context *msg_ctx, struct ctdbd_connection *conn, const char *name, int hash_size, int tdb_flags, diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c index 805e823be0b..feb9f5ebea2 100644 --- a/source3/lib/dbwrap/dbwrap_open.c +++ b/source3/lib/dbwrap/dbwrap_open.c @@ -144,6 +144,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, } /* allow ctdb for individual databases to be disabled */ if (lp_parm_bool(-1, "ctdb", partname, True)) { + struct messaging_context *msg_ctx; struct ctdbd_connection *conn; conn = messaging_ctdbd_connection(); @@ -152,7 +153,9 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, errno = EIO; return NULL; } - result = db_open_ctdb(mem_ctx, conn, partname, + msg_ctx = server_messaging_context(); + + result = db_open_ctdb(mem_ctx, msg_ctx, conn, partname, hash_size, tdb_flags, open_flags, mode, lock_order, dbwrap_flags); diff --git a/source3/torture/test_dbwrap_ctdb.c b/source3/torture/test_dbwrap_ctdb.c index 800b9fb58cd..b9bab9eb9e6 100644 --- a/source3/torture/test_dbwrap_ctdb.c +++ b/source3/torture/test_dbwrap_ctdb.c @@ -31,15 +31,18 @@ bool run_local_dbwrap_ctdb(int dummy) bool ret = false; NTSTATUS status; uint32_t val; + struct messaging_context *msg_ctx; struct ctdbd_connection *conn; + msg_ctx = server_messaging_context(); conn = messaging_ctdbd_connection(); if (conn == NULL) { fprintf(stderr, "no ctdbd connection\n"); goto fail; } - db = db_open_ctdb(talloc_tos(), conn, "torture.tdb", 0, TDB_DEFAULT, + db = db_open_ctdb(talloc_tos(), msg_ctx, conn, "torture.tdb", + 0, TDB_DEFAULT, O_RDWR, 0755, DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE); if (db == NULL) { perror("db_open_ctdb failed");