[SCM] CTDB repository - branch master updated - ctdb-1.0.95-2-g70e7781
Ronnie Sahlberg
sahlberg at samba.org
Tue Oct 13 15:27:33 MDT 2009
The branch, master has been updated
via 70e7781df1f118a0e2632a9c634f3fd388fa6c8c (commit)
from 346fa055f4106497b87df97da5ebd6e51fa1ef8c (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 70e7781df1f118a0e2632a9c634f3fd388fa6c8c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Oct 14 08:17:49 2009 +1100
Port Volkers deadlock avoidance patch to HEAD.
This patch ensures that we lock all non-notify related databases first and
then the notify databases to avoiud a deadlock where samba needs to lock records on two databases at once (and notify being the second database).
Newer versions of samba would instead use the set-db-prio control to set this explicitely on a database per database basis instead of relying on hardcoded database names. This patch will be reverted in the future when all updated versions of samba has been pushed out.
-----------------------------------------------------------------------
Summary of changes:
server/ctdb_freeze.c | 21 +++++++++++++++++++++
server/ctdb_recover.c | 20 ++++++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
Changeset truncated at 500 lines:
diff --git a/server/ctdb_freeze.c b/server/ctdb_freeze.c
index da7272f..a2b765b 100644
--- a/server/ctdb_freeze.c
+++ b/server/ctdb_freeze.c
@@ -33,10 +33,31 @@
static int ctdb_lock_all_databases(struct ctdb_context *ctdb, uint32_t priority)
{
struct ctdb_db_context *ctdb_db;
+ /* REMOVE later */
+ /* This double loop is for backward compatibility and deadlock
+ avoidance for old samba versions that not yet support
+ the set prio call.
+ This code shall be removed later
+ */
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
if (ctdb_db->priority != priority) {
continue;
}
+ if (strstr(ctdb_db->db_name, "notify") != NULL) {
+ continue;
+ }
+ DEBUG(DEBUG_INFO,("locking database 0x%08x priority:%u %s\n", ctdb_db->db_id, ctdb_db->priority, ctdb_db->db_name));
+ if (tdb_lockall(ctdb_db->ltdb->tdb) != 0) {
+ return -1;
+ }
+ }
+ for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
+ if (ctdb_db->priority != priority) {
+ continue;
+ }
+ if (strstr(ctdb_db->db_name, "notify") == NULL) {
+ continue;
+ }
DEBUG(DEBUG_INFO,("locking database 0x%08x priority:%u %s\n", ctdb_db->db_id, ctdb_db->priority, ctdb_db->db_name));
if (tdb_lockall(ctdb_db->ltdb->tdb) != 0) {
return -1;
diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c
index 40544f1..21dc28d 100644
--- a/server/ctdb_recover.c
+++ b/server/ctdb_recover.c
@@ -44,10 +44,30 @@ static int ctdb_lock_all_databases_mark(struct ctdb_context *ctdb, uint32_t prio
DEBUG(DEBUG_ERR,("Attempt to mark all databases locked when not frozen\n"));
return -1;
}
+ /* The dual loop is a woraround for older versions of samba
+ that does not yet support the set-db-priority/lock order
+ call. So that we get basic deadlock avoiidance also for
+ these old versions of samba.
+ This code will be removed in the future.
+ */
for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
if (ctdb_db->priority != priority) {
continue;
}
+ if (strstr(ctdb_db->db_name, "notify") != NULL) {
+ continue;
+ }
+ if (tdb_lockall_mark(ctdb_db->ltdb->tdb) != 0) {
+ return -1;
+ }
+ }
+ for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
+ if (ctdb_db->priority != priority) {
+ continue;
+ }
+ if (strstr(ctdb_db->db_name, "notify") == NULL) {
+ continue;
+ }
if (tdb_lockall_mark(ctdb_db->ltdb->tdb) != 0) {
return -1;
}
--
CTDB repository
More information about the samba-cvs
mailing list