From e0a032a2b929a985afc699594655c5055efec2a7 Mon Sep 17 00:00:00 2001 From: Martin Michlmayr Date: Sat, 26 Jul 2008 20:37:09 +0000 Subject: [PATCH] xfs: pack some shortform dir2 structures for the ARM old ABI architecture (closes: #414932). svn path=/dists/trunk/linux-2.6/; revision=11912 --- debian/changelog | 2 + .../bugfix/arm/xfs_pack_dir2_struct.patch | 82 +++++++++++++++++++ debian/patches/series/1~experimental.1 | 1 + 3 files changed, 85 insertions(+) create mode 100644 debian/patches/bugfix/arm/xfs_pack_dir2_struct.patch diff --git a/debian/changelog b/debian/changelog index 98036d04b..98af57d0c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -115,6 +115,8 @@ linux-2.6 (2.6.26-1~experimental.1) UNRELEASED; urgency=low * [arm/orion5x] Enable USB_PRINTER, requested by Mike Arthur. * [arm/orion5x] Enable binfmt aout, x25, wireless and ATM. * [arm/iop32x, arm/orion5x] Enable USB_SISUSBVGA. + * [arm] xfs: pack some shortform dir2 structures for the ARM old ABI + architecture (closes: #414932). [ Ian Campbell ] * Readme.build updated on how to generate orig tarballs. diff --git a/debian/patches/bugfix/arm/xfs_pack_dir2_struct.patch b/debian/patches/bugfix/arm/xfs_pack_dir2_struct.patch new file mode 100644 index 000000000..b12c0779b --- /dev/null +++ b/debian/patches/bugfix/arm/xfs_pack_dir2_struct.patch @@ -0,0 +1,82 @@ +From: Eric Sandeen +Date: Mon, 23 Jun 2008 03:23:32 +0000 (+1000) +Subject: [XFS] Pack some shortform dir2 structures for the ARM old ABI +X-Git-Url: http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs%2Fxfs-2.6.git;a=commitdiff_plain;h=7a9ba9bb899933293604a2b3c5ca4f40ad5a92a8 + +[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 +Signed-off-by: Tim Shimmin +Signed-off-by: Lachlan McIlroy +--- + +diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h +index aded573..4d45d93 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) + return x; + } + ++/* ARM old ABI has some weird alignment/padding */ ++#if defined(__arm__) && !defined(__ARM_EABI__) ++#define __arch_pack __attribute__((packed)) ++#else ++#define __arch_pack ++#endif ++ + #endif /* __XFS_LINUX__ */ +diff --git a/fs/xfs/xfs_dir2_sf.h b/fs/xfs/xfs_dir2_sf.h +index 005629d..deecc9d 100644 +--- a/fs/xfs/xfs_dir2_sf.h ++++ b/fs/xfs/xfs_dir2_sf.h +@@ -62,7 +62,7 @@ typedef union { + * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t. + * Only need 16 bits, this is the byte offset into the single block form. + */ +-typedef struct { __uint8_t i[2]; } xfs_dir2_sf_off_t; ++typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t; + + /* + * The parent directory has a dedicated field, and the self-pointer must +@@ -76,14 +76,14 @@ typedef struct xfs_dir2_sf_hdr { + __uint8_t count; /* count of entries */ + __uint8_t i8count; /* count of 8-byte inode #s */ + xfs_dir2_inou_t parent; /* parent dir inode number */ +-} xfs_dir2_sf_hdr_t; ++} __arch_pack xfs_dir2_sf_hdr_t; + + typedef struct xfs_dir2_sf_entry { + __uint8_t namelen; /* actual name length */ + xfs_dir2_sf_off_t offset; /* saved offset */ + __uint8_t name[1]; /* name, variable size */ + xfs_dir2_inou_t inumber; /* inode number, var. offset */ +-} xfs_dir2_sf_entry_t; ++} __arch_pack xfs_dir2_sf_entry_t; + + typedef struct xfs_dir2_sf { + xfs_dir2_sf_hdr_t hdr; /* shortform header */ diff --git a/debian/patches/series/1~experimental.1 b/debian/patches/series/1~experimental.1 index 81d0116f2..b8a867ffe 100644 --- a/debian/patches/series/1~experimental.1 +++ b/debian/patches/series/1~experimental.1 @@ -34,6 +34,7 @@ + bugfix/arm/disable-r6040.patch + bugfix/arm/ixp4xx_napi_fix.patch + bugfix/arm/kurobox_fix_nr_controllers.patch ++ bugfix/arm/xfs_pack_dir2_struct.patch + features/arm/speed_flush_cache.patch + features/arm/5281d0.patch + features/arm/fix_cache_alignment.patch