From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1916 invoked by alias); 11 Jun 2009 16:15:48 -0000 Received: (qmail 1910 invoked by alias); 11 Jun 2009 16:15:48 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_31,SPF_HELO_PASS X-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_31,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: RHEL5 - clogd/dm-log-clustered.ko: Fix arch mixing issues To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/RHEL5 X-Git-Reftype: branch X-Git-Oldrev: 935a60f838d37c848405d7df17404c3adad78392 X-Git-Newrev: 400a33b0a5f715702a419c46a10d0b3491130a53 From: Jonathan Brassow Message-Id: <20090611161519.DC3AA1201D7@lists.fedorahosted.org> Date: Thu, 11 Jun 2009 16:15:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q2/txt/msg00503.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=400a33b0a5f715702a419c46a10d0b3491130a53 Commit: 400a33b0a5f715702a419c46a10d0b3491130a53 Parent: 935a60f838d37c848405d7df17404c3adad78392 Author: Jonathan Brassow AuthorDate: Thu Jun 11 11:14:03 2009 -0500 Committer: Jonathan Brassow CommitterDate: Thu Jun 11 11:14:03 2009 -0500 clogd/dm-log-clustered.ko: Fix arch mixing issues Fix arch mixing issues by being explicit about variable sizes (int vs int32_t, etc) and doing padding where necessary. --- cmirror-kernel/src/dm-clog-tfr.c | 2 +- cmirror-kernel/src/dm-clog-tfr.h | 5 +++-- cmirror-kernel/src/dm-clog.c | 18 +++++++++++++++--- cmirror/src/functions.c | 23 ++++++++++++++++++----- cmirror/src/local.c | 1 + 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/cmirror-kernel/src/dm-clog-tfr.c b/cmirror-kernel/src/dm-clog-tfr.c index 3ceb320..778ffb7 100644 --- a/cmirror-kernel/src/dm-clog-tfr.c +++ b/cmirror-kernel/src/dm-clog-tfr.c @@ -105,7 +105,7 @@ static int fill_pkg(struct cn_msg *msg, struct clog_tfr *tfr) } else if (tfr->data_size > *(pkg->data_size)) { DMERR("Insufficient space to receive package [%s]::", RQ_TYPE(tfr->request_type)); - DMERR(" tfr->data_size = %u", tfr->data_size); + DMERR(" tfr->data_size = %llu", tfr->data_size); DMERR(" *(pkg->data_size) = %u", *(pkg->data_size)); *(pkg->data_size) = 0; diff --git a/cmirror-kernel/src/dm-clog-tfr.h b/cmirror-kernel/src/dm-clog-tfr.h index bdf4b6d..dcf7e91 100644 --- a/cmirror-kernel/src/dm-clog-tfr.h +++ b/cmirror-kernel/src/dm-clog-tfr.h @@ -52,13 +52,14 @@ struct clog_tfr { uint64_t private[2]; char uuid[DM_UUID_LEN]; /* Ties a request to a specific mirror log */ + char uuid_padding[7]; /* DM_UUID_LEN == 129 */ - int error; /* Used by server to inform of errors */ + int32_t error; /* Used by server to inform of errors */ uint32_t originator; /* Cluster ID of this machine */ uint32_t seq; /* Sequence number for request */ uint32_t request_type; /* DM_CLOG_* */ - uint32_t data_size; /* How much data (not including this struct) */ + uint64_t data_size; /* How much data (not including this struct) */ char data[0]; }; diff --git a/cmirror-kernel/src/dm-clog.c b/cmirror-kernel/src/dm-clog.c index f21823e..be08331 100644 --- a/cmirror-kernel/src/dm-clog.c +++ b/cmirror-kernel/src/dm-clog.c @@ -536,7 +536,11 @@ static int cluster_get_resync_work(struct dm_dirty_log *log, region_t *region) int r; int rdata_size; struct log_c *lc = (struct log_c *)log->context; - struct { int i; region_t r; } pkg; + struct { + int32_t i; + uint32_t arch_padding; + region_t r; + } pkg; if (lc->in_sync_hint >= lc->region_count) return 0; @@ -564,7 +568,11 @@ static void cluster_set_region_sync(struct dm_dirty_log *log, { int r; struct log_c *lc = (struct log_c *)log->context; - struct { region_t r; int i; } pkg; + struct { + region_t r; + uint32_t arch_padding; + int32_t i; + } pkg; pkg.r = region; pkg.i = in_sync; @@ -659,7 +667,11 @@ static int cluster_is_remote_recovering(struct dm_dirty_log *log, region_t regio int r; struct log_c *lc = (struct log_c *)log->context; static unsigned long long limit = 0; - struct { int is_recovering; uint64_t in_sync_hint; } pkg; + struct { + int32_t is_recovering; + uint32_t arch_padding; + uint64_t in_sync_hint; + } pkg; int rdata_size = sizeof(pkg); /* diff --git a/cmirror/src/functions.c b/cmirror/src/functions.c index 45fdc1a..0523e9c 100644 --- a/cmirror/src/functions.c +++ b/cmirror/src/functions.c @@ -545,8 +545,9 @@ static int clog_ctr(struct clog_tfr *tfr) if (strlen(tfr->data) != tfr->data_size) { LOG_ERROR("Received constructor request with bad data"); - LOG_ERROR("strlen(tfr->data)[%d] != tfr->data_size[%d]", - (int)strlen(tfr->data), tfr->data_size); + LOG_ERROR("strlen(tfr->data)[%d] != tfr->data_size[%llu]", + (int)strlen(tfr->data), + (unsigned long long)tfr->data_size); LOG_ERROR("tfr->data = '%s' [%d]", tfr->data, (int)strlen(tfr->data)); return -EINVAL; @@ -1164,7 +1165,11 @@ static int clog_clear_region(struct clog_tfr *tfr) */ static int clog_get_resync_work(struct clog_tfr *tfr) { - struct {int i; uint64_t r; } *pkg = (void *)tfr->data; + struct { + int32_t i; + uint32_t arch_padding; + uint64_t r; + } *pkg = (void *)tfr->data; struct log_c *lc = get_log(tfr->uuid); if (!lc) @@ -1254,7 +1259,11 @@ static int clog_get_resync_work(struct clog_tfr *tfr) */ static int clog_set_region_sync(struct clog_tfr *tfr) { - struct { uint64_t region; int in_sync; } *pkg = (void *)tfr->data; + struct { + uint64_t region; + uint32_t arch_padding; + int32_t in_sync; + } *pkg = (void *)tfr->data; struct log_c *lc = get_log(tfr->uuid); if (!lc) @@ -1485,7 +1494,11 @@ static int clog_status_table(struct clog_tfr *tfr) static int clog_is_remote_recovering(struct clog_tfr *tfr) { uint64_t region = *((uint64_t *)(tfr->data)); - struct { int is_recovering; uint64_t in_sync_hint; } *pkg = (void *)tfr->data; + struct { + int32_t is_recovering; + uint32_t arch_padding; + uint64_t in_sync_hint; + } *pkg = (void *)tfr->data; struct log_c *lc = get_log(tfr->uuid); if (!lc) diff --git a/cmirror/src/local.c b/cmirror/src/local.c index 7f9a403..cf64855 100644 --- a/cmirror/src/local.c +++ b/cmirror/src/local.c @@ -263,6 +263,7 @@ static int do_local_work(void *data) case DM_CLOG_GET_REGION_SIZE: default: LOG_ERROR("Invalid log request received, ignoring."); + return 0; }