Closed GoogleCodeExporter closed 9 years ago
hostb:
Linux hostb 2.6.22-14-zumastor #1 SMP Thu Mar 27 06:36:14 GMT 2008 x86_64
GNU/Linux
zumastor v0.8.0 revision 1532 built on Thu Apr 10 18:15:33 EDT 2008 by
root@hostb
(X4500)
hosta:
zumastor v0.8.0 revision 1532 built on Wed Apr 9 14:17:00 PDT 2008 by
build@unassigned
Linux hosta 2.6.22.18-zumastor-r1491 #1 SMP PREEMPT Mon Mar 24 12:10:22 PDT
2008
i686 GNU/Linux
(Dell PE2950)
Original comment by williama...@gmail.com
on 10 Apr 2008 at 11:20
if hostb replicates to hosta you get:
Thu Apr 10 16:38:39 2008: [30958] apply_delta_extents: compressed data
corrupted in
delta for 4294967296 chunk extent starting at offset 0
applied streamed delta to "/dev/mapper/smallvol", closing connection
Thu Apr 10 16:38:39 2008: [30956] ddsnap_delta_server: unable to accept
connection:
Interrupted system call
Thu Apr 10 16:38:39 2008: [30956] ddsnap_delta_server: Caught signal 17
Thu Apr 10 16:38:40 2008: [30956] ddsnap_delta_server: unable to accept
connection:
Interrupted system call
Thu Apr 10 16:38:40 2008: [30956] ddsnap_delta_server: Caught signal 15
Thu Apr 10 16:38:40 2008: [30983] daemonize: starting at Thu Apr 10 16:38:40
2008
in the log of hosta
Original comment by williama...@gmail.com
on 10 Apr 2008 at 11:39
Looks like the problem is because of the different alignment on 32-bit and
64-bit
machines.
struct delta_header
{
char magic[MAGIC_SIZE];
u64 chunk_num;
u32 chunk_size;
u32 src_snap;
u32 tgt_snap;
};
sizeof(struct delta_header) returns 28 on 32-bit machine, but 32 on 64-bit
machine.
We can use #pragma pack(4) to solve the problem, but it may have some
performance
impact. Any other thoughts?
Jiaying
Original comment by jiayin...@gmail.com
on 11 Apr 2008 at 1:20
Marking the structure as packed is fine, and is in fact probably what Dan P.
intended.
Original comment by daniel.r...@gmail.com
on 11 Apr 2008 at 1:25
Here is the proposed patch:
Index: ddsnap.c
===================================================================
--- ddsnap.c (revision 1533)
+++ ddsnap.c (working copy)
@@ -226,13 +226,7 @@
u32 tgt_snap;
};
-struct vol_header
-{
- char magic[MAGIC_SIZE];
- u64 vol_size_bytes;
- u32 chunksize_bits;
-};
-
+#pragma pack(4)
struct delta_header
{
char magic[MAGIC_SIZE];
@@ -253,6 +247,7 @@
u64 ext1_chksum;
u64 ext2_chksum;
};
+#pragma options align=reset
static u64 checksum(const unsigned char *data, u32 data_length)
{
Except for using packed structure for delta_header and delta_extent_header, I
also
deleted a structure vol_header that is not used anywhere. I tried the patch on
my
32bit and 64bit testing machines. Looks like it solves the problem.
Jiaying
Original comment by jiayin...@gmail.com
on 11 Apr 2008 at 7:30
Just write PACKED before the semicolon at the end of the struct definition.
This is
a macro for gcc's __attribute__ ((packed))
Daniel
Original comment by Daniel.R...@gmail.com
on 13 Apr 2008 at 11:14
Thanks for the comments! Here is the modified patch.
Index: ddsnap.c
===================================================================
--- ddsnap.c (revision 1533)
+++ ddsnap.c (working copy)
@@ -226,13 +226,6 @@
u32 tgt_snap;
};
-struct vol_header
-{
- char magic[MAGIC_SIZE];
- u64 vol_size_bytes;
- u32 chunksize_bits;
-};
-
struct delta_header
{
char magic[MAGIC_SIZE];
@@ -240,7 +233,7 @@
u32 chunk_size;
u32 src_snap;
u32 tgt_snap;
-};
+} PACKED;
struct delta_extent_header
{
@@ -252,7 +245,7 @@
u64 extents_delta_length;
u64 ext1_chksum;
u64 ext2_chksum;
-};
+} PACKED;
static u64 checksum(const unsigned char *data, u32 data_length)
{
Jiaying
Original comment by jiayin...@gmail.com
on 14 Apr 2008 at 7:07
Looks like the whitespace got munged, attaching a copy of that patch.
Original comment by williama...@gmail.com
on 14 Apr 2008 at 8:16
Attachments:
Fixed with revision 1537.
Original comment by jiahotc...@gmail.com
on 15 Apr 2008 at 6:25
Original issue reported on code.google.com by
williama...@gmail.com
on 10 Apr 2008 at 11:16