[SCM] CTDB repository - branch master updated - ctdb-1.0.114-124-g8818d5c
Ronnie Sahlberg
sahlberg at samba.org
Wed Jun 2 00:50:59 MDT 2010
The branch, master has been updated
via 8818d5c483558c0faa6a3923ed5e675fdcfc13af (commit)
from 07b395258ab08218e8eed3b4a52654925b85275c (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8818d5c483558c0faa6a3923ed5e675fdcfc13af
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jun 2 16:49:05 2010 +1000
ctdb_req_control contains 4 padding bytes. Create an explicit pad variable here and set it to 0 when creating a control to keep valgrind happy.
PDUs are padded to 8 byte boundary. If padding is used, memset it to 0
to keep valgrind happy.
-----------------------------------------------------------------------
Summary of changes:
include/ctdb_protocol.h | 1 +
libctdb/ctdb.c | 1 +
libctdb/io_elem.c | 7 +++++++
3 files changed, 9 insertions(+), 0 deletions(-)
Changeset truncated at 500 lines:
diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
index 2a334b9..7a5d32d 100644
--- a/include/ctdb_protocol.h
+++ b/include/ctdb_protocol.h
@@ -410,6 +410,7 @@ struct ctdb_reply_getdbpath {
struct ctdb_req_control {
struct ctdb_req_header hdr;
uint32_t opcode;
+ uint32_t pad;
uint64_t srvid;
uint32_t client_id;
#define CTDB_CTRL_FLAG_NOREPLY 1
diff --git a/libctdb/ctdb.c b/libctdb/ctdb.c
index 39f4bab..8700a60 100644
--- a/libctdb/ctdb.c
+++ b/libctdb/ctdb.c
@@ -354,6 +354,7 @@ struct ctdb_request *new_ctdb_control_request(struct ctdb_connection *ctdb,
CTDB_REQ_CONTROL, destnode, new_reqid(ctdb));
pkt = req->hdr.control;
+ pkt->pad = 0;
pkt->opcode = opcode;
pkt->srvid = 0;
pkt->client_id = 0;
diff --git a/libctdb/io_elem.c b/libctdb/io_elem.c
index ada7778..1a17698 100644
--- a/libctdb/io_elem.c
+++ b/libctdb/io_elem.c
@@ -17,6 +17,7 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
@@ -34,6 +35,8 @@ struct io_elem {
struct io_elem *new_io_elem(size_t len)
{
struct io_elem *elem;
+ size_t ask = len;
+
len = (len + (CTDB_DS_ALIGNMENT-1)) & ~(CTDB_DS_ALIGNMENT-1);
elem = malloc(sizeof(*elem));
@@ -45,6 +48,10 @@ struct io_elem *new_io_elem(size_t len)
return NULL;
}
+ /* stamp out any padding to keep valgrind happy */
+ if (ask != len) {
+ memset(elem->data + ask, 0, len-ask);
+ }
elem->len = len;
elem->off = 0;
return elem;
--
CTDB repository
More information about the samba-cvs
mailing list