rename ctdb.h to ctdb_protocol.h
[sahlberg/ctdb.git] / server / ctdb_lockwait.c
index 03a7eedf46cc4fff7b38f7f6b7e48488739f1d1f..5128a3e05ea04774b58d92bddd46b4e09bd452a5 100644 (file)
@@ -23,7 +23,8 @@
 #include "system/wait.h"
 #include "db_wrap.h"
 #include "lib/tdb/include/tdb.h"
-#include "../include/ctdb_private.h"
+#include "include/ctdb_protocol.h"
+#include "include/ctdb_private.h"
 
 
 struct lockwait_handle {
@@ -53,7 +54,7 @@ static void lockwait_handler(struct event_context *ev, struct fd_event *fde,
        key.dptr = talloc_memdup(tmp_ctx, key.dptr, key.dsize);
 
        talloc_set_destructor(h, NULL);
-       ctdb_latency(&h->ctdb->statistics.max_lockwait_latency, h->start_time);
+       ctdb_latency(h->ctdb_db, "lockwait", &h->ctdb->statistics.max_lockwait_latency, h->start_time);
        h->ctdb->statistics.pending_lockwait_calls--;
 
        /* the handle needs to go away when the context is gone - when
@@ -146,6 +147,10 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db,
        }
 
        close(result->fd[1]);
+       set_close_on_exec(result->fd[0]);
+
+       DEBUG(DEBUG_DEBUG, (__location__ " Created PIPE FD:%d to child lockwait process\n", result->fd[0]));
+
        talloc_set_destructor(result, lockwait_destructor);
 
        result->fde = event_add_fd(ctdb_db->ctdb->ev, result, result->fd[0],