struct g_lock_ctx;
struct g_lock_lock_cb_state;
struct messaging_context;
+struct tevent_context;
+struct ctdbd_connection;
enum g_lock_type {
G_LOCK_READ,
struct db_context **backend);
void g_lock_set_lock_order(struct g_lock_ctx *ctx,
enum dbwrap_lock_order lock_order);
+struct g_lock_ctx *g_lock_ctx_init_ex(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg,
+ struct tevent_context *ev_ctx_ex,
+ struct ctdbd_connection *ctdb_conn_ex);
struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
struct messaging_context *msg);
ctx->lock_order = lock_order;
}
-struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
- struct messaging_context *msg)
+struct g_lock_ctx *g_lock_ctx_init_ex(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg,
+ struct tevent_context *ev_ctx_ex,
+ struct ctdbd_connection *ctdb_conn_ex)
{
char *db_path = NULL;
struct db_context *backend = NULL;
struct g_lock_ctx *ctx = NULL;
+ SMB_ASSERT(msg != NULL);
+
db_path = lock_path(mem_ctx, "g_lock.tdb");
if (db_path == NULL) {
return NULL;
}
- backend = db_open(
+ backend = db_open_ex(
mem_ctx,
+ ev_ctx_ex,
+ msg,
+ ctdb_conn_ex,
db_path,
0,
TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH|TDB_VOLATILE,
return ctx;
}
+struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg)
+{
+ struct g_lock_ctx *ctx = NULL;
+ static bool busy;
+
+ SMB_ASSERT(!busy);
+
+ busy = true;
+ ctx = g_lock_ctx_init_ex(mem_ctx,
+ msg,
+ NULL, /* ev_ctx_ex */
+ NULL); /* ctdb_conn_ex */
+ busy = false;
+
+ return ctx;
+}
+
static void g_lock_cleanup_dead(
struct g_lock *lck,
struct server_id *dead_blocker)