diff options
author | Volker Lendecke <vl@samba.org> | 2013-02-20 15:09:36 +0100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2014-07-09 04:19:12 +0200 |
commit | 1627171792567fc55290330feaaef9d9efc66c48 (patch) | |
tree | 87c874d93055f36e852631225c59ca10c38b1d2c /ctdb | |
parent | 91be76dbe93a2be763a93163bec8c17d35057944 (diff) | |
download | samba-1627171792567fc55290330feaaef9d9efc66c48.tar.gz |
ctdb-daemon: Allow flag TDB_MUTEX_LOCKING to pass into db_attach
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/server/ctdb_ltdb_server.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index bec27c8992c..12c087cb6aa 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -741,7 +741,7 @@ int ctdb_set_db_readonly(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb */ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, bool persistent, const char *unhealthy_reason, - bool jenkinshash) + bool jenkinshash, bool mutexes) { struct ctdb_db_context *ctdb_db, *tmp_db; int ret; @@ -836,6 +836,9 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, if (jenkinshash) { tdb_flags |= TDB_INCOMPATIBLE_HASH; } + if (mutexes) { + tdb_flags |= TDB_MUTEX_LOCKING; + } again: ctdb_db->ltdb = tdb_wrap_open(ctdb_db, ctdb_db->db_path, @@ -1065,7 +1068,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, struct ctdb_db_context *db; struct ctdb_node *node = ctdb->nodes[ctdb->pnn]; struct ctdb_client *client = NULL; - bool with_jenkinshash; + bool with_jenkinshash, with_mutexes; if (ctdb->tunable.allow_client_db_attach == 0) { DEBUG(DEBUG_ERR, ("DB Attach to database %s denied by tunable " @@ -1118,7 +1121,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, only allow a subset of those on the database in ctdb. Note that tdb_flags is passed in via the (otherwise unused) srvid to the attach control */ - tdb_flags &= (TDB_NOSYNC|TDB_INCOMPATIBLE_HASH); + tdb_flags &= (TDB_NOSYNC|TDB_INCOMPATIBLE_HASH|TDB_MUTEX_LOCKING); /* see if we already have this name */ db = ctdb_db_handle(ctdb, db_name); @@ -1136,9 +1139,10 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, } with_jenkinshash = (tdb_flags & TDB_INCOMPATIBLE_HASH) ? true : false; + with_mutexes = (tdb_flags & TDB_MUTEX_LOCKING) ? true : false; if (ctdb_local_attach(ctdb, db_name, persistent, NULL, - with_jenkinshash) != 0) { + with_jenkinshash, with_mutexes) != 0) { return -1; } @@ -1311,7 +1315,7 @@ static int ctdb_attach_persistent(struct ctdb_context *ctdb, } p[4] = 0; - if (ctdb_local_attach(ctdb, s, true, unhealthy_reason, false) != 0) { + if (ctdb_local_attach(ctdb, s, true, unhealthy_reason, false, false) != 0) { DEBUG(DEBUG_ERR,("Failed to attach to persistent database '%s'\n", de->d_name)); closedir(d); talloc_free(s); |