s4-ldb: move the tdb_reopen_all() calls to ldb_wrap.c
authorAndrew Tridgell <tridge@samba.org>
Fri, 23 Oct 2009 03:50:56 +0000 (14:50 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 23 Oct 2009 03:52:18 +0000 (14:52 +1100)
source4/lib/ldb_wrap.c
source4/smbd/process_prefork.c
source4/smbd/process_standard.c

index 1166acd3a2281503205d081bd5defbc901f9ba47..ecd7bf455436c55a86f342324ccc602544afd37c 100644 (file)
@@ -35,6 +35,7 @@
 #include "dsdb/samdb/samdb.h"
 #include "param/param.h"
 #include "dlinklist.h"
+#include "../tdb/include/tdb.h"
 
 /*
   this is used to catch debug messages from ldb
@@ -263,7 +264,13 @@ void ldb_wrap_fork_hook(void)
        struct ldb_wrap *w;
 
        for (w=ldb_wrap_list; w; w=w->next) {
-               ldb_transaction_cancel_noerr(w->ldb);
+               if (ldb_transaction_cancel_noerr(w->ldb) != LDB_SUCCESS) {
+                       smb_panic("Failed to cancel child transactions\n");
+               }
        }       
+
+       if (tdb_reopen_all(1) == -1) {
+               smb_panic("tdb_reopen_all failed\n");
+       }
 }
 
index db5633b9f26aef55f293f04d71da5040c50c2234..f890a528d52e52413b07b048313f3a1786559068 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "includes.h"
 #include "lib/events/events.h"
-#include "../tdb/include/tdb.h"
 #include "lib/socket/socket.h"
 #include "smbd/process_model.h"
 #include "param/secrets.h"
@@ -57,10 +56,6 @@ static void prefork_model_init(struct tevent_context *ev)
 
 static void prefork_reload_after_fork(void)
 {
-       /* tdb needs special fork handling */
-       if (tdb_reopen_all(1) == -1) {
-               DEBUG(0,("prefork_reload_after_fork: tdb_reopen_all failed.\n"));
-       }
        ldb_wrap_fork_hook();
 
        /* Ensure that the forked children do not expose identical random streams */
index 6e7b714a633b27c532e4fb4c83aeb1bd8c9daa49..ab5ad5760c626b2b63fda64a606544737247a4bc 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "includes.h"
 #include "lib/events/events.h"
-#include "../tdb/include/tdb.h"
 #include "smbd/process_model.h"
 #include "system/filesys.h"
 #include "cluster/cluster.h"
@@ -125,9 +124,6 @@ static void standard_accept_connection(struct tevent_context *ev,
        socket_dup(sock2);
                        
        /* tdb needs special fork handling */
-       if (tdb_reopen_all(1) == -1) {
-               DEBUG(0,("standard_accept_connection: tdb_reopen_all failed.\n"));
-       }
        ldb_wrap_fork_hook();
 
        tevent_add_fd(ev2, ev2, child_pipe[0], TEVENT_FD_READ,
@@ -192,10 +188,7 @@ static void standard_new_task(struct tevent_context *ev,
           is not associated with this new connection */
        talloc_free(ev);
 
-       /* tdb needs special fork handling */
-       if (tdb_reopen_all(1) == -1) {
-               DEBUG(0,("standard_accept_connection: tdb_reopen_all failed.\n"));
-       }
+       /* ldb/tdb need special fork handling */
        ldb_wrap_fork_hook();
 
        tevent_add_fd(ev2, ev2, child_pipe[0], TEVENT_FD_READ,