diff options
author | Amitay Isaacs <amitay@gmail.com> | 2014-06-30 15:09:32 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2014-07-09 04:19:12 +0200 |
commit | 2e7b0870ec1014f8320032b86dc54f0a6fd55776 (patch) | |
tree | e9d62b6f6889b8fc24651417fca44ed68b007da5 /ctdb | |
parent | 1627171792567fc55290330feaaef9d9efc66c48 (diff) | |
download | samba-2e7b0870ec1014f8320032b86dc54f0a6fd55776.tar.gz |
ctdb-daemon: Enable robust mutexes only if TDB_MUTEX_LOCKING is defined
Runtime check for robust mutexes is performed just before opening local tdb.
Signed-off-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 | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index 12c087cb6aa..afa33d14852 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -836,9 +836,11 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, if (jenkinshash) { tdb_flags |= TDB_INCOMPATIBLE_HASH; } - if (mutexes) { +#ifdef TDB_MUTEX_LOCKING + if (mutexes && tdb_runtime_check_for_robust_mutexes()) { tdb_flags |= TDB_MUTEX_LOCKING; } +#endif again: ctdb_db->ltdb = tdb_wrap_open(ctdb_db, ctdb_db->db_path, @@ -1121,7 +1123,11 @@ 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 */ +#ifdef TDB_MUTEX_LOCKING tdb_flags &= (TDB_NOSYNC|TDB_INCOMPATIBLE_HASH|TDB_MUTEX_LOCKING); +#else + tdb_flags &= (TDB_NOSYNC|TDB_INCOMPATIBLE_HASH); +#endif /* see if we already have this name */ db = ctdb_db_handle(ctdb, db_name); @@ -1139,7 +1145,11 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, } with_jenkinshash = (tdb_flags & TDB_INCOMPATIBLE_HASH) ? true : false; +#ifdef TDB_MUTEX_LOCKING with_mutexes = (tdb_flags & TDB_MUTEX_LOCKING) ? true : false; +#else + with_mutexes = false; +#endif if (ctdb_local_attach(ctdb, db_name, persistent, NULL, with_jenkinshash, with_mutexes) != 0) { |