smbd: Move brl_validate to the cleanupd
authorVolker Lendecke <vl@samba.org>
Sat, 7 Nov 2015 19:18:52 +0000 (20:18 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 16 Nov 2015 13:51:33 +0000 (14:51 +0100)
This walks brlock.tdb, which can be time-consuming.

This adds a new includes.h include. It's too much of a pain for me now to
make locking/proto.h clean to include on its own.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/server.c
source3/smbd/smbd_cleanupd.c

index b83cfdd33f605d4e764495ffa4842f808c328060..048d2138ad0bf5236a03a1181d7fb57ecd96d0c8 100644 (file)
@@ -283,8 +283,10 @@ static int smbd_parent_ctdb_reconfigured(
         * Someone from the family died, validate our locks
         */
 
-       messaging_send_buf(msg_ctx, messaging_server_id(msg_ctx),
-                          MSG_SMB_BRL_VALIDATE, NULL, 0);
+       if (am_parent) {
+               messaging_send_buf(msg_ctx, am_parent->cleanupd,
+                                  MSG_SMB_BRL_VALIDATE, NULL, 0);
+       }
 
        return 0;
 }
@@ -545,8 +547,8 @@ static void cleanup_timeout_fn(struct tevent_context *event_ctx,
 
        DEBUG(1,("Cleaning up brl and lock database after unclean shutdown\n"));
        message_send_all(parent->msg_ctx, MSG_SMB_UNLOCK, NULL, 0, NULL);
-       messaging_send_buf(parent->msg_ctx,
-                          messaging_server_id(parent->msg_ctx),
+
+       messaging_send_buf(parent->msg_ctx, parent->cleanupd,
                           MSG_SMB_BRL_VALIDATE, NULL, 0);
 }
 
@@ -1003,8 +1005,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
        messaging_register(msg_ctx, NULL, MSG_SMB_STAT_CACHE_DELETE,
                           smb_stat_cache_delete);
        messaging_register(msg_ctx, NULL, MSG_DEBUG, smbd_msg_debug);
-       messaging_register(msg_ctx, NULL, MSG_SMB_BRL_VALIDATE,
-                          brl_revalidate);
        messaging_register(msg_ctx, NULL, MSG_SMB_FORCE_TDIS,
                           smb_parent_send_to_children);
        messaging_register(msg_ctx, NULL, MSG_SMB_KILL_CLIENT_IP,
index e931a28e8a98bac44ac05d3e58559f72de41b455..6b423e3cd2cb9502bcd9d3aee02165d7a6706730 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "replace.h"
+#include "includes.h"
 #include "smbd_cleanupd.h"
 #include "lib/util_procid.h"
 #include "lib/util/tevent_ntstatus.h"
 #include "lib/util/debug.h"
 #include "smbprofile.h"
 #include "serverid.h"
+#include "locking/proto.h"
 
 struct smbd_cleanupd_state {
        pid_t parent_pid;
@@ -65,6 +66,12 @@ struct tevent_req *smbd_cleanupd_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
+       status = messaging_register(msg, NULL, MSG_SMB_BRL_VALIDATE,
+                                   brl_revalidate);
+       if (tevent_req_nterror(req, status)) {
+               return tevent_req_post(req, ev);
+       }
+
        return req;
 }