diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2008-06-22 23:23:32 -0400 |
---|---|---|
committer | Niv Sardi <xaiki@debian.org> | 2008-07-28 02:58:50 -0400 |
commit | ae23a5e87dbbf4657a82e1ff8ebc52ab50361c14 (patch) | |
tree | 4165d72de28027d7cedf6ba8daa305b59f5304f0 | |
parent | 0ec585163ac81e329bde25fb6311a043a1c63952 (diff) |
[XFS] Pack some shortform dir2 structures for the ARM old ABI
architecture.
This should fix the longstanding issues with xfs and old ABI arm boxes,
which lead to various asserts and xfs shutdowns, and for which an
(incorrect) patch has been floating around for years.
I've verified this patch by comparing the on-disk structure layouts using
pahole from the dwarves package, as well as running through a bit of xfsqa
under qemu-arm, modified so that the check/repair phase after each test
actually executes check/repair from the x86 host, on the filesystem
populated by the arm emulator. Thus far it all looks good.
There are 2 other structures with extra padding at the end, but they don't
seem to cause trouble. I suppose they could be packed as well:
xfs_dir2_data_unused_t and xfs_dir2_sf_t.
Note that userspace needs a similar treatment, and any filesystems which
were running with the previous rogue "fix" will now see corruption (either
in the kernel, or during xfs_repair) with this fix properly in place; it
may be worth teaching xfs_repair to identify and fix that specific issue.
SGI-PV: 982930
SGI-Modid: xfs-linux-melb:xfs-kern:31280a
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
-rw-r--r-- | fs/xfs/linux-2.6/xfs_linux.h | 7 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_sf.h | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index aded57321b12..4d45d9351a6c 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h | |||
@@ -300,4 +300,11 @@ static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y) | |||
300 | return x; | 300 | return x; |
301 | } | 301 | } |
302 | 302 | ||
303 | /* ARM old ABI has some weird alignment/padding */ | ||
304 | #if defined(__arm__) && !defined(__ARM_EABI__) | ||
305 | #define __arch_pack __attribute__((packed)) | ||
306 | #else | ||
307 | #define __arch_pack | ||
308 | #endif | ||
309 | |||
303 | #endif /* __XFS_LINUX__ */ | 310 | #endif /* __XFS_LINUX__ */ |
diff --git a/fs/xfs/xfs_dir2_sf.h b/fs/xfs/xfs_dir2_sf.h index 005629d702d2..deecc9d238f8 100644 --- a/fs/xfs/xfs_dir2_sf.h +++ b/fs/xfs/xfs_dir2_sf.h | |||
@@ -62,7 +62,7 @@ typedef union { | |||
62 | * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t. | 62 | * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t. |
63 | * Only need 16 bits, this is the byte offset into the single block form. | 63 | * Only need 16 bits, this is the byte offset into the single block form. |
64 | */ | 64 | */ |
65 | typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t; | 65 | typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t; |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * The parent directory has a dedicated field, and the self-pointer must | 68 | * The parent directory has a dedicated field, and the self-pointer must |
@@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr { | |||
76 | __uint8_t count; /* count of entries */ | 76 | __uint8_t count; /* count of entries */ |
77 | __uint8_t i8count; /* count of 8-byte inode #s */ | 77 | __uint8_t i8count; /* count of 8-byte inode #s */ |
78 | xfs_dir2_inou_t parent; /* parent dir inode number */ | 78 | xfs_dir2_inou_t parent; /* parent dir inode number */ |
79 | } xfs_dir2_sf_hdr_t; | 79 | } __arch_pack xfs_dir2_sf_hdr_t; |
80 | 80 | ||
81 | typedef struct xfs_dir2_sf_entry { | 81 | typedef struct xfs_dir2_sf_entry { |
82 | __uint8_t namelen; /* actual name length */ | 82 | __uint8_t namelen; /* actual name length */ |
83 | xfs_dir2_sf_off_t offset; /* saved offset */ | 83 | xfs_dir2_sf_off_t offset; /* saved offset */ |
84 | __uint8_t name[1]; /* name, variable size */ | 84 | __uint8_t name[1]; /* name, variable size */ |
85 | xfs_dir2_inou_t inumber; /* inode number, var. offset */ | 85 | xfs_dir2_inou_t inumber; /* inode number, var. offset */ |
86 | } xfs_dir2_sf_entry_t; | 86 | } __arch_pack xfs_dir2_sf_entry_t; |
87 | 87 | ||
88 | typedef struct xfs_dir2_sf { | 88 | typedef struct xfs_dir2_sf { |
89 | xfs_dir2_sf_hdr_t hdr; /* shortform header */ | 89 | xfs_dir2_sf_hdr_t hdr; /* shortform header */ |