The branch, master has been updated via 478ef94 ctdb: Fix verbose_memory_names via 70c79f5 ctdb: Avoid a talloc in ctdb_queue_send from 5907b0c sys_poll_intr: fix timeout arithmetic
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 478ef9493f131c4d94bada708f790db3254f0a59 Author: Volker Lendecke <v...@samba.org> Date: Mon Jul 21 09:48:45 2014 +0000 ctdb: 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 commit 70c79f514024551128acc2d3ba879ef1407ed130 Author: Volker Lendecke <v...@samba.org> Date: Mon Jul 21 09:42:54 2014 +0000 ctdb: Avoid a talloc in ctdb_queue_send Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: ctdb/common/ctdb_io.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c index 351006d..b5f8a72 100644 --- a/ctdb/common/ctdb_io.c +++ b/ctdb/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; -- Samba Shared Repository