[SCM] SAMBA-CTDB repository - branch v3-4-ctdb updated - 3.4.2-ctdb-20-2-gcb39faa

Michael Adam obnox at samba.org
Mon Feb 8 14:57:22 MST 2010


The branch, v3-4-ctdb has been updated
       via  cb39faaa1dd3e70ba61d9e26c0117fa9c46c351a (commit)
       via  0710d76be8858fb6aa38d58b27fd8c8888e90edc (commit)
      from  381137d4f1fef5c6c686b805fb0e320212958e2a (commit)

http://gitweb.samba.org/?p=obnox/samba-ctdb.git;a=shortlog;h=v3-4-ctdb


- Log -----------------------------------------------------------------
commit cb39faaa1dd3e70ba61d9e26c0117fa9c46c351a
Author: Michael Adam <obnox at samba.org>
Date:   Mon Feb 8 15:49:35 2010 +0100

    v3-4-ctdb: bump ctdb vendor patch level to 21

commit 0710d76be8858fb6aa38d58b27fd8c8888e90edc
Author: Michael Adam <obnox at samba.org>
Date:   Mon Feb 8 11:01:47 2010 +0100

    s3:registry: eliminate race condition in creating/scanning sorted subkeys
    
    Called, from key_exists, scan_sorted_subkeys re-creates the sorted
    subkeys record of the given key and then searches through it.
    The race is that between creation and parsing of the sorted subkey
    record, another process that stores some other subkey of the same
    parent key will delete the sorted subkey record, resulting in an
    WERR_BADFILE of an operation that should actually succeed.
    
    This patch fixes the issue by wrapping the creation and parsing
    into a transaction.
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source3/VERSION                   |    2 +-
 source3/registry/reg_backend_db.c |   17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/VERSION b/source3/VERSION
index f70eb89..7b8bf5a 100644
--- a/source3/VERSION
+++ b/source3/VERSION
@@ -85,7 +85,7 @@ SAMBA_VERSION_IS_GIT_SNAPSHOT=no
 #                                                      #
 ########################################################
 SAMBA_VERSION_VENDOR_SUFFIX="ctdb"
-SAMBA_VERSION_VENDOR_PATCH=20
+SAMBA_VERSION_VENDOR_PATCH=21
 
 ########################################################
 # This can be set by vendors if they want..            #
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 96d581c..2339d6b 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -1372,14 +1372,31 @@ static bool scan_parent_subkeys(struct db_context *db, const char *parent,
 	if (state.scanned) {
 		result = state.found;
 	} else {
+		res = db->transaction_start(db);
+		if (res != 0) {
+			DEBUG(0, ("error starting transacion\n"));
+			goto fail;
+		}
+
 		if (!create_sorted_subkeys(path, key)) {
+			res = db->transaction_cancel(db);
+			if (res != 0) {
+				smb_panic("Failed to cancel transaction.");
+			}
 			goto fail;
 		}
+
 		res = db->parse_record(db, string_term_tdb_data(key),
 				       parent_subkey_scanner, &state);
 		if ((res == 0) && (state.scanned)) {
 			result = state.found;
 		}
+
+		res = db->transaction_commit(db);
+		if (res != 0) {
+			DEBUG(0, ("error committing transaction\n"));
+			result = false;
+		}
 	}
 
  fail:


-- 
SAMBA-CTDB repository


More information about the samba-cvs mailing list