From: Michael Neumann Date: Sun, 21 Feb 2010 11:39:26 +0000 (+0100) Subject: HAMMER - Fix mirroring between 32 and 64-bit machines X-Git-Tag: v2.7.0~156^2~1 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/c7380858c7d940d981d93b5e17984bc652a3cb5c HAMMER - Fix mirroring between 32 and 64-bit machines We need to pack struct hammer_pseudofs_data as it had differing sizes on 32-bit vs. 64-bit machines. As this structure is send over-the-wire this lead to an early abort in the hammer mirroring code (cmd_mirror.c) when mirroring a PFS from a 32-bit machine to a 64-bit machine or vice versa as it sanity checks the packets it gets. Even so the structure is stored on-media, the change in size is no issue as the tail is zero-padded with reserved fields. WARNING: After this change, mirroring between 64-bit machines predating this commit and updated 64-bit machines will no longer work. PLEASE UPDATE them all in one go or leave them unmodified. 32-bit machines are not affected at all, as this commit does not change the size of the structure for 32-bit machines. Discussed-with: Matthew Dillon --- diff --git a/sys/vfs/hammer/hammer_disk.h b/sys/vfs/hammer/hammer_disk.h index 7de627aec6..6871246254 100644 --- a/sys/vfs/hammer/hammer_disk.h +++ b/sys/vfs/hammer/hammer_disk.h @@ -798,6 +798,14 @@ struct hammer_symlink_data { * * sync_low_tid is not yet used but will represent the highest pruning * end-point, after which full history is available. + * + * We need to pack this structure making it equally sized on both 32-bit and + * 64-bit machines as it is part of struct hammer_ioc_mrecord_pfs which is + * send over the wire in hammer mirror operations. Only on 64-bit machines + * the size of this struct differ when packed or not. This leads us to the + * situation where old 64-bit systems (using the non-packed structure), + * which were never able to mirror to/from 32-bit systems, are now no longer + * able to mirror to/from newer 64-bit systems (using the packed structure). */ struct hammer_pseudofs_data { hammer_tid_t sync_low_tid; /* full history beyond this point */ @@ -819,7 +827,7 @@ struct hammer_pseudofs_data { int32_t prune_min; /* do not prune recent history */ int32_t prune_max; /* do not retain history beyond here */ int32_t reserved[16]; -}; +} __packed; typedef struct hammer_pseudofs_data *hammer_pseudofs_data_t;