The branch, master has been updated via 55fbe36 ctdb-daemon: Support per-node robust mutex feature via 2e7b087 ctdb-daemon: Enable robust mutexes only if TDB_MUTEX_LOCKING is defined via 1627171 ctdb-daemon: Allow flag TDB_MUTEX_LOCKING to pass into db_attach via 91be76d ctdb-daemon: Simplify code a bit via 1ed330f ctdb-daemon: Use false instead of 0 for boolean arguments from f01af72 smbd: Use mutex instead of fcntl lock for echohandler coordination
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 55fbe364b93000c7766e95e16fa35cc6a80c697b Author: Amitay Isaacs <ami...@gmail.com> Date: Mon Nov 11 00:32:31 2013 +1100 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 <ami...@gmail.com> Reviewed-by: Stefan Metzmacher <me...@samba.org> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Wed Jul 9 06:45:17 CEST 2014 on sn-devel-104 commit 2e7b0870ec1014f8320032b86dc54f0a6fd55776 Author: Amitay Isaacs <ami...@gmail.com> Date: Mon Jun 30 15:09:32 2014 +1000 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 <ami...@gmail.com> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 1627171792567fc55290330feaaef9d9efc66c48 Author: Volker Lendecke <v...@samba.org> Date: Wed Feb 20 15:09:36 2013 +0100 ctdb-daemon: Allow flag TDB_MUTEX_LOCKING to pass into db_attach Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 91be76dbe93a2be763a93163bec8c17d35057944 Author: Amitay Isaacs <ami...@gmail.com> Date: Tue Jun 24 12:04:25 2014 +1000 ctdb-daemon: Simplify code a bit Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 1ed330f7cbd753b6c29246d522c5ddca5160d8bb Author: Amitay Isaacs <ami...@gmail.com> Date: Tue Jun 24 11:46:53 2014 +1000 ctdb-daemon: Use false instead of 0 for boolean arguments Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Stefan Metzmacher <me...@samba.org> ----------------------------------------------------------------------- Summary of changes: ctdb/client/ctdb_client.c | 12 ++++++++++++ ctdb/include/ctdb_private.h | 1 + ctdb/server/ctdb_ltdb_server.c | 25 ++++++++++++++++++++++--- ctdb/server/ctdb_tunables.c | 1 + 4 files changed, 36 insertions(+), 3 deletions(-) Changeset truncated at 500 lines: diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index c8ab1cd..df57302 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 aeebed1..e94d2c8 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 7738f76..55abf1f 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,12 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, if (jenkinshash) { tdb_flags |= TDB_INCOMPATIBLE_HASH; } +#ifdef TDB_MUTEX_LOCKING + if (ctdb->tunable.mutex_enabled && 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, @@ -1065,6 +1071,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, with_mutexes; if (ctdb->tunable.allow_client_db_attach == 0) { DEBUG(DEBUG_ERR, ("DB Attach to database %s denied by tunable " @@ -1117,7 +1124,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); @@ -1134,7 +1145,15 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, return 0; } - if (ctdb_local_attach(ctdb, db_name, persistent, NULL, (tdb_flags&TDB_INCOMPATIBLE_HASH)?true:false) != 0) { + 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) { return -1; } @@ -1307,7 +1326,7 @@ static int ctdb_attach_persistent(struct ctdb_context *ctdb, } p[4] = 0; - if (ctdb_local_attach(ctdb, s, true, unhealthy_reason, 0) != 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); diff --git a/ctdb/server/ctdb_tunables.c b/ctdb/server/ctdb_tunables.c index f760cb5..4a252b6 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 }, }; /* -- Samba Shared Repository