summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-07-04 05:16:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:59:04 -0500
commit2a8f9213a4d945834271f23da538bd20310f90a1 (patch)
treef7be4032f39bdc408af688524a82e7c048e6f149 /source4
parentb4d9778a805e22676a951266c1e0cd18a81162d6 (diff)
downloadsamba-2a8f9213a4d945834271f23da538bd20310f90a1.tar.gz
samba-2a8f9213a4d945834271f23da538bd20310f90a1.tar.bz2
samba-2a8f9213a4d945834271f23da538bd20310f90a1.zip
r23700: 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. (This used to be commit ff41bdc350cf05c70c63effe30fe69e63181f088)
Diffstat (limited to 'source4')
-rw-r--r--source4/smb_server/smb_server.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index 4fbc428a42..33b2fc77a4 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -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,6 +193,19 @@ static NTSTATUS smb_add_socket(struct event_context *event_context,
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
*/
@@ -220,6 +234,8 @@ static void smbsrv_task_init(struct task_server *task)
if (!NT_STATUS_IS_OK(status)) goto failed;
}
+ smbsrv_preopen_ldb(task);
+
return;
failed:
task_server_terminate(task, "Failed to startup smb server task");