The branch, 2.5 has been updated
       via  0cd00c7b3347f4d1355723f01a07883f137140cf (commit)
       via  600ee0b6874bbd4a0b7aaf9e3ffd09cc561cecec (commit)
      from  5bf756da8bc2d9106b1e4ada42db3d4f5d9e5b81 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=2.5


- Log -----------------------------------------------------------------
commit 0cd00c7b3347f4d1355723f01a07883f137140cf
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Jul 21 09:48:45 2014 +0000

    common: Fix verbose_memory_names
    
    If we have already partly written a packet, "data" and thus "pkt->data"
    does not point to the start of the packet anymore. Assign "hdr" while
    it still points at the start of the header.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Amitay Isaacs <ami...@gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <ami...@samba.org>
    Autobuild-Date(master): Tue Jul 22 06:09:50 CEST 2014 on sn-devel-104
    
    (Imported from commit 478ef9493f131c4d94bada708f790db3254f0a59)

commit 600ee0b6874bbd4a0b7aaf9e3ffd09cc561cecec
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Jul 21 09:42:54 2014 +0000

    common: Avoid a talloc in ctdb_queue_send
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Amitay Isaacs <ami...@gmail.com>
    
    (Imported from commit 70c79f514024551128acc2d3ba879ef1407ed130)

-----------------------------------------------------------------------

Summary of changes:
 common/ctdb_io.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/common/ctdb_io.c b/common/ctdb_io.c
index 351006d..b5f8a72 100644
--- a/common/ctdb_io.c
+++ b/common/ctdb_io.c
@@ -44,6 +44,7 @@ struct ctdb_queue_pkt {
        uint8_t *data;
        uint32_t length;
        uint32_t full_length;
+       uint8_t buf[];
 };
 
 struct ctdb_queue {
@@ -285,6 +286,7 @@ static void queue_io_handler(struct event_context *ev, 
struct fd_event *fde,
 */
 int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
 {
+       struct ctdb_req_header *hdr = (struct ctdb_req_header *)data;
        struct ctdb_queue_pkt *pkt;
        uint32_t length2, full_length;
 
@@ -324,11 +326,13 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t 
*data, uint32_t length)
                if (length2 == 0) return 0;
        }
 
-       pkt = talloc(queue, struct ctdb_queue_pkt);
+       pkt = talloc_size(
+               queue, offsetof(struct ctdb_queue_pkt, buf) + length2);
        CTDB_NO_MEMORY(queue->ctdb, pkt);
+       talloc_set_name_const(pkt, "struct ctdb_queue_pkt");
 
-       pkt->data = talloc_memdup(pkt, data, length2);
-       CTDB_NO_MEMORY(queue->ctdb, pkt->data);
+       pkt->data = pkt->buf;
+       memcpy(pkt->data, data, length2);
 
        pkt->length = length2;
        pkt->full_length = full_length;
@@ -342,7 +346,6 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t 
*data, uint32_t length)
        queue->out_queue_length++;
 
        if (queue->ctdb->tunable.verbose_memory_names != 0) {
-               struct ctdb_req_header *hdr = (struct ctdb_req_header 
*)pkt->data;
                switch (hdr->operation) {
                case CTDB_REQ_CONTROL: {
                        struct ctdb_req_control *c = (struct ctdb_req_control 
*)hdr;


-- 
CTDB repository

Reply via email to