diff options
author | Amitay Isaacs <amitay@gmail.com> | 2013-11-11 00:32:31 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2014-07-09 06:45:17 +0200 |
commit | 55fbe364b93000c7766e95e16fa35cc6a80c697b (patch) | |
tree | 8ab8e316a8c8ff4667576a74145d4a66c0fd7d13 | |
parent | 2e7b0870ec1014f8320032b86dc54f0a6fd55776 (diff) | |
download | samba-55fbe364b93000c7766e95e16fa35cc6a80c697b.tar.gz samba-55fbe364b93000c7766e95e16fa35cc6a80c697b.tar.xz samba-55fbe364b93000c7766e95e16fa35cc6a80c697b.zip |
ctdb-daemon: Support per-node robust mutex feature
To enable TDB mutex support, set tunable TDBMutexEnabled=1.
When databases are attached for the first time, attach flags must include
TDB_MUTEX_LOCKING and TDBMutexEnabled must set to enable mutex support.
However, when CTDB attaches databases internally for recovery, it will
enable mutex support if TDBMutexEnabled is set.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Jul 9 06:45:17 CEST 2014 on sn-devel-104
-rw-r--r-- | ctdb/client/ctdb_client.c | 12 | ||||
-rw-r--r-- | ctdb/include/ctdb_private.h | 1 | ||||
-rw-r--r-- | ctdb/server/ctdb_ltdb_server.c | 3 | ||||
-rw-r--r-- | ctdb/server/ctdb_tunables.c | 1 |
4 files changed, 16 insertions, 1 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index c8ab1cd6cb..df57302de0 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -1926,6 +1926,12 @@ int ctdb_ctrl_createdb(struct ctdb_context *ctdb, struct timeval timeout, uint32 tdb_flags = TDB_INCOMPATIBLE_HASH; } +#ifdef TDB_MUTEX_LOCKING + if (!persistent && ctdb->tunable.mutex_enabled == 1) { + tdb_flags |= TDB_MUTEX_LOCKING; + } +#endif + ret = ctdb_control(ctdb, destnode, tdb_flags, persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH, 0, data, @@ -2073,6 +2079,12 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, tdb_flags |= TDB_INCOMPATIBLE_HASH; } +#ifdef TDB_MUTEX_LOCKING + if (!persistent && ctdb->tunable.mutex_enabled == 1) { + tdb_flags |= TDB_MUTEX_LOCKING; + } +#endif + /* tell ctdb daemon to attach */ ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, tdb_flags, persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH, diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index aeebed1b51..e94d2c84f6 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -126,6 +126,7 @@ struct ctdb_tunable { uint32_t pulldb_preallocation_size; uint32_t no_ip_host_on_all_disabled; uint32_t samba3_hack; + uint32_t mutex_enabled; }; /* diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index afa33d1485..55abf1f544 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -837,7 +837,8 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, tdb_flags |= TDB_INCOMPATIBLE_HASH; } #ifdef TDB_MUTEX_LOCKING - if (mutexes && tdb_runtime_check_for_robust_mutexes()) { + if (ctdb->tunable.mutex_enabled && mutexes && + tdb_runtime_check_for_robust_mutexes()) { tdb_flags |= TDB_MUTEX_LOCKING; } #endif diff --git a/ctdb/server/ctdb_tunables.c b/ctdb/server/ctdb_tunables.c index f760cb57bd..4a252b61ad 100644 --- a/ctdb/server/ctdb_tunables.c +++ b/ctdb/server/ctdb_tunables.c @@ -82,6 +82,7 @@ static const struct { { "PullDBPreallocation", 10*1024*1024, offsetof(struct ctdb_tunable, pulldb_preallocation_size), false }, { "NoIPHostOnAllDisabled", 0, offsetof(struct ctdb_tunable, no_ip_host_on_all_disabled), false }, { "Samba3AvoidDeadlocks", 0, offsetof(struct ctdb_tunable, samba3_hack), false }, + { "TDBMutexEnabled", 0, offsetof(struct ctdb_tunable, mutex_enabled), false }, }; /* |