diff --git a/e2fsprogs-1.40.7-swap-inode-full-fix.patch b/e2fsprogs-1.40.7-swap-inode-full-fix.patch index 0e3c55f..43cda02 100644 --- a/e2fsprogs-1.40.7-swap-inode-full-fix.patch +++ b/e2fsprogs-1.40.7-swap-inode-full-fix.patch @@ -1,8 +1,30 @@ -Index: e2fsprogs-1.40.7/lib/ext2fs/swapfs.c -=================================================================== ---- e2fsprogs-1.40.7.orig/lib/ext2fs/swapfs.c -+++ e2fsprogs-1.40.7/lib/ext2fs/swapfs.c -@@ -133,7 +133,7 @@ void ext2fs_swap_inode_full(ext2_filsys +From: Eric Sandeen +Date: Fri, 29 Feb 2008 22:10:21 +0000 (-0600) +Subject: Fix ext2fs_swap_inode_full() for in-inode xattrs on big-endian machines +X-Git-Url: http://git.kernel.org/?p=fs%2Fext2%2Fe2fsprogs.git;a=commitdiff_plain;h=82e541885ea912bc6764b97e2545f851cf7e3ff3 + +Fix ext2fs_swap_inode_full() for in-inode xattrs on big-endian machines + +After the fix for resize2fs's inode mover losing in-inode +extended attributes, the regression test I wrote caught +that the attrs were still getting lost on powerpc. + +Looks like the problem is that ext2fs_swap_inode_full() +isn't paying attention to whether or not the EA magic is +in hostorder, so it's not recognized (and not swapped) +on BE machines. Patch below seems to fix it. + +Yay for regression tests. ;) + +Signed-off-by: Eric Sandeen +Signed-off-by: Theodore Ts'o +--- + +diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c +index 6576c59..e07e87c 100644 +--- a/lib/ext2fs/swapfs.c ++++ b/lib/ext2fs/swapfs.c +@@ -133,7 +133,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t, struct ext2_inode_large *f, int hostorder, int bufsize) { @@ -11,26 +33,17 @@ Index: e2fsprogs-1.40.7/lib/ext2fs/swapfs.c int islnk = 0; __u32 *eaf, *eat; -@@ -231,13 +231,17 @@ void ext2fs_swap_inode_full(ext2_filsys - +@@ -232,7 +232,11 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t, eaf = (__u32 *) (((char *) f) + sizeof(struct ext2_inode) + extra_isize); -- + - if (ext2fs_swab32(*eaf) != EXT2_EXT_ATTR_MAGIC) -- return; /* it seems no magic here */ -- - eat = (__u32 *) (((char *) t) + sizeof(struct ext2_inode) + - extra_isize); -+ -+ if (hostorder) -+ attr_magic = *eaf; - *eat = ext2fs_swab32(*eaf); ++ attr_magic = *eaf; + if (!hostorder) -+ attr_magic = *eat; ++ attr_magic = ext2fs_swab32(attr_magic); + + if (attr_magic != EXT2_EXT_ATTR_MAGIC) -+ return; /* it seems no magic here */ + return; /* it seems no magic here */ - /* convert EA(s) */ - ext2fs_swap_ext_attr((char *) (eat + 1), (char *) (eaf + 1), + eat = (__u32 *) (((char *) t) + sizeof(struct ext2_inode) + diff --git a/e2fsprogs-1.40.8-blkid-swap-tests.patch b/e2fsprogs-1.40.8-blkid-swap-tests.patch new file mode 100644 index 0000000..8bc80f0 --- /dev/null +++ b/e2fsprogs-1.40.8-blkid-swap-tests.patch @@ -0,0 +1,42 @@ +[PATCH] blkid: more sanity checks for swap v1 + +mkswap followed by pvcreate on a block device +will still turn up as "swap" in blkid, because +pvcreate isn't particularly careful about zeroing +old signatures. (neither is mkswap, for that matter). + +Testing for appropriate version and page counts +gives us a bit more confidence that we have a +real swap (v1) partition. + +Signed-off-by: Eric Sandeen +--- + lib/blkid/probe.c | 7 ++++++- + 1 files changed, 6 insertions(+), 1 deletions(-) + +diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c +index 45885c3..a070201 100644 +--- a/lib/blkid/probe.c ++++ b/lib/blkid/probe.c +@@ -827,7 +827,7 @@ static int probe_swap0(struct blkid_probe *probe, + } + + static int probe_swap1(struct blkid_probe *probe, +- struct blkid_magic *id __BLKID_ATTR((unused)), ++ struct blkid_magic *id, + unsigned char *buf __BLKID_ATTR((unused))) + { + struct swap_id_block *sws; +@@ -843,6 +843,11 @@ static int probe_swap1(struct blkid_probe *probe, + if (!sws) + return 1; + ++ /* check for wrong version or zeroed pagecount, for sanity */ ++ if (!memcmp(id->bim_magic, "SWAPSPACE2", id->bim_len) && ++ (sws->sws_version != 1 || sws->sws_lastpage == 0)) ++ return 1; ++ + /* arbitrary sanity check.. is there any garbage down there? */ + if (sws->sws_pad[32] == 0 && sws->sws_pad[33] == 0) { + if (sws->sws_volume[0]) +-- 1.5.4.1 diff --git a/e2fsprogs.spec b/e2fsprogs.spec index cc84f84..0f92c88 100644 --- a/e2fsprogs.spec +++ b/e2fsprogs.spec @@ -4,7 +4,7 @@ Summary: Utilities for managing the second and third extended (ext2/ext3) filesystems Name: e2fsprogs Version: 1.40.8 -Release: 1%{?dist} +Release: 2%{?dist} # License based on upstream-modified COPYING file, # which clearly states "V2" intent. License: GPLv2 @@ -16,6 +16,7 @@ Source3: uuidd.init Patch1: e2fsprogs-1.38-etcblkid.patch Patch2: e2fsprogs-1.40.4-sb_feature_check_ignore.patch Patch3: e2fsprogs-1.40.7-swap-inode-full-fix.patch +Patch4: e2fsprogs-1.40.8-blkid-swap-tests.patch Url: http://e2fsprogs.sourceforge.net/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -94,6 +95,8 @@ SMP systems. %patch2 -p1 -b .featurecheck # fix in-inode ea swapping in swap_inode_full %patch3 -p1 -b .swapinode +# check a bit more in swapv1 headers before recognizing as swap +%patch4 -p1 -b .swapchecks %build %configure --enable-elf-shlibs --enable-nls --disable-e2initrd-helper --enable-blkid-devmapper --enable-blkid-selinux @@ -281,6 +284,10 @@ fi %dir %attr(2775, uuidd, uuidd) /var/lib/libuuid %changelog +* Fri Mar 14 2008 Eric Sandeen 1.40.8-2 +- Update ext2fs_swap_inode_full() fix to match upstream +- Check more of swapv1 header in blkid detection (#442937) + * Fri Mar 14 2008 Eric Sandeen 1.40.8-1 - New upstream version