svn commit: samba r23700 - in branches/SAMBA_4_0/source/smb_server: .

tridge at samba.org tridge at samba.org
Wed Jul 4 05:16:20 GMT 2007


Author: tridge
Date: 2007-07-04 05:16:19 +0000 (Wed, 04 Jul 2007)
New Revision: 23700

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23700

Log:

pre-open the sam in the parent smbd. This has the effect of loading
the schema. That stops us loading the schema for each new connection.

In future I would prefer to share a lot more of our ldb contexts with
children. That will require a larger piece of surgery.

Modified:
   branches/SAMBA_4_0/source/smb_server/smb_server.c


Changeset:
Modified: branches/SAMBA_4_0/source/smb_server/smb_server.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/smb_server.c	2007-07-04 05:15:06 UTC (rev 23699)
+++ branches/SAMBA_4_0/source/smb_server/smb_server.c	2007-07-04 05:16:19 UTC (rev 23700)
@@ -32,6 +32,7 @@
 #include "system/network.h"
 #include "lib/socket/netif.h"
 #include "param/share.h"
+#include "dsdb/samdb/samdb.h"
 
 static NTSTATUS smbsrv_recv_generic_request(void *private, DATA_BLOB blob)
 {
@@ -192,7 +193,20 @@
 	return NT_STATUS_OK;
 }
 
+
 /*
+  pre-open some of our ldb databases, to prevent an explosion of memory usage
+  when we fork
+ */
+static void smbsrv_preopen_ldb(struct task_server *task)
+{
+	/* yes, this looks strange. It is a hack to preload the
+	   schema. I'd like to share most of the ldb context with the
+	   child too. That will come later */
+	talloc_free(samdb_connect(task, NULL));
+}
+
+/*
   open the smb server sockets
 */
 static void smbsrv_task_init(struct task_server *task)
@@ -220,6 +234,8 @@
 		if (!NT_STATUS_IS_OK(status)) goto failed;
 	}
 
+	smbsrv_preopen_ldb(task);
+
 	return;
 failed:
 	task_server_terminate(task, "Failed to startup smb server task");	



More information about the samba-cvs mailing list