[SCM] Samba Shared Repository - branch v3-6-test updated
Michael Adam
obnox at samba.org
Fri May 13 05:54:10 MDT 2011
The branch, v3-6-test has been updated
via b1fe69d s3:registry: add a warning debug message when the sorted subkeys is created from key_exists()
via fc26b96 s3:registry: recreate the sorted subkeys cache when storing keys
via 39bc60c s3:registry: add create_sorted_subkeys() to delete and recreate the sorted subkeys key
via 42b3df6 s3:registry: turn create_sorted_subkeys_internal to NTSTATUS return type
via 8ea96a2 s3:registry: rename create_sorted_subkeys() to create_sorted_subkeys_internal()
via 1a0a2f3 s3:registry: fix a typo in a debug message
from d137081 s3-libnetjoin: fix uninitialized variable.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit b1fe69df942e6e831e42b84aade0fb74d6bc6a0f
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 16:19:41 2011 +0200
s3:registry: add a warning debug message when the sorted subkeys is created from key_exists()
commit fc26b96a392f824cf18ab8524a5eaddfd2c03c5c
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 15:58:48 2011 +0200
s3:registry: recreate the sorted subkeys cache when storing keys
This is to avoid turning the next read operation into a write op.
commit 39bc60c77d5083c5ca68a83f55a3c6efde9b78a7
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 15:27:01 2011 +0200
s3:registry: add create_sorted_subkeys() to delete and recreate the sorted subkeys key
This is to be used from other places than the key_exists() code path.
commit 42b3df64d497894b8a45861c54f2958bf3c28e24
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 14:53:48 2011 +0200
s3:registry: turn create_sorted_subkeys_internal to NTSTATUS return type
(from bool)
commit 8ea96a246c903d787cc0a79c33ffbce5b0307af8
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 14:49:10 2011 +0200
s3:registry: rename create_sorted_subkeys() to create_sorted_subkeys_internal()
commit 1a0a2f35e2bfbc5194de846fde4ae800338b3311
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 14:17:21 2011 +0200
s3:registry: fix a typo in a debug message
-----------------------------------------------------------------------
Summary of changes:
source3/registry/reg_backend_db.c | 55 ++++++++++++++++++++++++-------------
1 files changed, 36 insertions(+), 19 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 6024a35..fa79c68 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -47,6 +47,8 @@ static int regdb_fetch_values_internal(struct db_context *db, const char* key,
static bool regdb_store_values_internal(struct db_context *db, const char *key,
struct regval_ctr *values);
+static NTSTATUS create_sorted_subkeys(const char *key);
+
/* List the deepest path into the registry. All part components will be created.*/
/* If you want to have a part of the path controlled by the tdb and part by
@@ -831,22 +833,9 @@ static WERROR regdb_store_keys_internal2(struct db_context *db,
W_ERROR_NOT_OK_GOTO_DONE(werr);
/*
- * Delete a sorted subkey cache for regdb_key_exists, will be
- * recreated automatically
+ * recreate the sorted subkey cache for regdb_key_exists()
*/
- keyname = talloc_asprintf(ctx, "%s\\%s", REG_SORTED_SUBKEYS_PREFIX,
- keyname);
- if (keyname == NULL) {
- werr = WERR_NOMEM;
- goto done;
- }
-
- werr = ntstatus_to_werror(dbwrap_delete_bystring(db, keyname));
-
- /* don't treat WERR_NOT_FOUND as an error here */
- if (W_ERROR_EQUAL(werr, WERR_NOT_FOUND)) {
- werr = WERR_OK;
- }
+ werr = ntstatus_to_werror(create_sorted_subkeys(keyname));
done:
TALLOC_FREE(ctx);
@@ -1407,7 +1396,8 @@ done:
return status;
}
-static bool create_sorted_subkeys(const char *key, const char *sorted_keyname)
+static NTSTATUS create_sorted_subkeys_internal(const char *key,
+ const char *sorted_keyname)
{
NTSTATUS status;
struct create_sorted_subkeys_context sorted_ctx;
@@ -1419,7 +1409,26 @@ static bool create_sorted_subkeys(const char *key, const char *sorted_keyname)
create_sorted_subkeys_action,
&sorted_ctx);
- return NT_STATUS_IS_OK(status);
+ return status;
+}
+
+static NTSTATUS create_sorted_subkeys(const char *key)
+{
+ char *sorted_subkeys_keyname;
+ NTSTATUS status;
+
+ sorted_subkeys_keyname = talloc_asprintf(talloc_tos(), "%s\\%s",
+ REG_SORTED_SUBKEYS_PREFIX,
+ key);
+ if (sorted_subkeys_keyname == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ status = create_sorted_subkeys_internal(key, sorted_subkeys_keyname);
+
+done:
+ return status;
}
struct scan_subkey_state {
@@ -1499,13 +1508,21 @@ static bool scan_parent_subkeys(struct db_context *db, const char *parent,
if (state.scanned) {
result = state.found;
} else {
+ NTSTATUS status;
+
res = db->transaction_start(db);
if (res != 0) {
- DEBUG(0, ("error starting transacion\n"));
+ DEBUG(0, ("error starting transaction\n"));
goto fail;
}
- if (!create_sorted_subkeys(path, key)) {
+ DEBUG(2, (__location__ " WARNING: recreating the sorted "
+ "subkeys cache for key '%s' from scan_parent_subkeys "
+ "this should not happen (too frequently)...\n",
+ path));
+
+ status = create_sorted_subkeys_internal(path, key);
+ if (!NT_STATUS_IS_OK(status)) {
res = db->transaction_cancel(db);
if (res != 0) {
smb_panic("Failed to cancel transaction.");
--
Samba Shared Repository
More information about the samba-cvs
mailing list