Make "make test" startup more reliable

Volker Lendecke Volker.Lendecke at SerNet.DE
Sat Apr 9 10:25:00 MDT 2011


Hi!

The attached patch makes "make test" startup a lot more
reliable for me on even lightly loaded systems.

Comments?

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
-------------- next part --------------
>From 6ba31d3bd29dd11b1b98859f4d8a65d9be7dac60 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sat, 9 Apr 2011 18:13:59 +0200
Subject: [PATCH 1/2] s3: Make reg_backend_db.h includable by itself

---
 source3/registry/reg_backend_db.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/source3/registry/reg_backend_db.h b/source3/registry/reg_backend_db.h
index fbdcfb4..9d5ff90 100644
--- a/source3/registry/reg_backend_db.h
+++ b/source3/registry/reg_backend_db.h
@@ -21,6 +21,7 @@
 #ifndef _REG_BACKEND_DB_H
 #define _REG_BACKEND_DB_H
 
+#include "registry.h"
 
 WERROR init_registry_key(const char *add_path);
 WERROR init_registry_data(void);
-- 
1.7.0.4


>From f1aa38b414e97d8687d0bebf65baa384f75301b4 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sat, 9 Apr 2011 18:15:12 +0200
Subject: [PATCH 2/2] s3: Wrap creating the svcctl keys in a transaction

This makes the startup of smbd in make test much quicker and thus more reliable
---
 source3/rpc_server/svcctl/srv_svcctl_reg.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/source3/rpc_server/svcctl/srv_svcctl_reg.c b/source3/rpc_server/svcctl/srv_svcctl_reg.c
index d262ff8..eb0c2bd 100644
--- a/source3/rpc_server/svcctl/srv_svcctl_reg.c
+++ b/source3/rpc_server/svcctl/srv_svcctl_reg.c
@@ -30,6 +30,7 @@
 #include "rpc_client/cli_winreg.h"
 #include "rpc_server/svcctl/srv_svcctl_reg.h"
 #include "auth.h"
+#include "registry/reg_backend_db.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_REGISTRY
@@ -575,6 +576,19 @@ bool svcctl_init_winreg(struct messaging_context *msg_ctx)
 		goto done;
 	}
 
+	result = regdb_open();
+	if (!W_ERROR_IS_OK(result)) {
+		DEBUG(10, ("regdb_open failed: %s\n",
+			   win_errstr(result)));
+		goto done;
+	}
+	result = regdb_transaction_start();
+	if (!W_ERROR_IS_OK(result)) {
+		DEBUG(10, ("regdb_transaction_start failed: %s\n",
+			   win_errstr(result)));
+		goto done;
+	}
+
 	status = dcerpc_winreg_int_hklm_openkey(tmp_ctx,
 						get_session_info_system(),
 						msg_ctx,
@@ -674,6 +688,20 @@ done:
 		dcerpc_winreg_CloseKey(h, tmp_ctx, &key_hnd, &result);
 	}
 
+	if (ok) {
+		result = regdb_transaction_commit();
+		if (!W_ERROR_IS_OK(result)) {
+			DEBUG(10, ("regdb_transaction_commit failed: %s\n",
+				   win_errstr(result)));
+		}
+	} else {
+		result = regdb_transaction_cancel();
+		if (!W_ERROR_IS_OK(result)) {
+			DEBUG(10, ("regdb_transaction_cancel failed: %s\n",
+				   win_errstr(result)));
+		}
+	}
+	regdb_close();
 	return ok;
 }
 
-- 
1.7.0.4



More information about the samba-technical mailing list