Hi!
When following Chapter 6.22 on Coreutils-8.10, the test suite fails
for sparse-fiemap on ext4 filesystem. The problem is discussed and
fixed here:
http://lists.gnu.org/archive/html/bug-coreutils/2011-02/msg00054.html
Therefore, I propose the attached patch against the latest revision of
LFS SVN (revision 9481) as well as the coreutils patch to be put in
http://www.linuxfromscratch.org/patches/lfs/development/
--
Best regards,
Eus (FSF member #4445)
In this digital era, where computing technology is pervasive, your
freedom depends on the software controlling those computing devices.
Join free software movement today! It is free as in freedom, not as in
free beer!
Join: http://www.fsf.org/
diff -ruN LFS.orig/chapter03/patches.xml LFS.patch/chapter03/patches.xml
--- LFS.orig/chapter03/patches.xml 2011-03-07 12:26:44.000000000 +0100
+++ LFS.patch/chapter03/patches.xml 2011-03-07 12:10:38.000000000 +0100
@@ -35,6 +35,14 @@
</varlistentry>
<varlistentry>
+ <term>Coreutils sparse_fiemap Test Patch - <token>&coreutils-sparse_fiemap-patch-size;</token>:</term>
+ <listitem>
+ <para>Download: <ulink url="&patches-root;&coreutils-sparse_fiemap-patch;"/></para>
+ <para>MD5 sum: <literal>&coreutils-sparse_fiemap-patch-md5;</literal></para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>Coreutils Uname Patch - <token>&coreutils-uname-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&coreutils-uname-patch;"/></para>
diff -ruN LFS.orig/chapter06/coreutils.xml LFS.patch/chapter06/coreutils.xml
--- LFS.orig/chapter06/coreutils.xml 2011-03-07 12:26:45.000000000 +0100
+++ LFS.patch/chapter06/coreutils.xml 2011-03-07 12:19:53.000000000 +0100
@@ -87,8 +87,15 @@
<para>Skip down to <quote>Install the
package</quote> if not running the test suite.</para>
- <para>Now the test suite is ready to be run. First, run the tests that are
- meant to be run as user <systemitem class="username">root</systemitem>:</para>
+ <para>Now the test suite is ready to be run. A weakness in the test script of
+ <emphasis>sparse-fiemap</emphasis> as described in
+ <ulink url="http://lists.gnu.org/archive/html/bug-coreutils/2011-02/msg00054.html"/>
+ can be fixed with the following patch:</para>
+
+<screen><userinput remap="pre">patch -Np1 -i ../&coreutils-sparse_fiemap-patch;</userinput></screen>
+
+ <para>First, run the tests that are meant to be run as user
+ <systemitem class="username">root</systemitem>:</para>
<screen><userinput remap="test">make NON_ROOT_USERNAME=nobody check-root</userinput></screen>
diff -ruN LFS.orig/patches.ent LFS.patch/patches.ent
--- LFS.orig/patches.ent 2011-03-07 12:26:44.000000000 +0100
+++ LFS.patch/patches.ent 2011-03-07 12:01:13.000000000 +0100
@@ -11,6 +11,10 @@
<!ENTITY coreutils-i18n-patch-md5 "28895e1112835ca04119158d1883a6d5">
<!ENTITY coreutils-i18n-patch-size "120 KB">
+<!ENTITY coreutils-sparse_fiemap-patch "coreutils-&coreutils-version;-sparse_fiemap-1.patch">
+<!ENTITY coreutils-sparse_fiemap-patch-md5 "667171817a8f73c8d4c76c0014069396">
+<!ENTITY coreutils-sparse_fiemap-patch-size "4.7 KB">
+
<!ENTITY coreutils-uname-patch "coreutils-&coreutils-version;-uname-1.patch">
<!ENTITY coreutils-uname-patch-md5 "500481b75892e5c07e19e9953a690e54">
<!ENTITY coreutils-uname-patch-size "1.6 KB">
>From 1da62d67ce4d4c78b98bc947c9367a10f1bdba9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <address@hidden>
Date: Fri, 4 Feb 2011 22:05:20 +0000
Subject: [PATCH] test: improve the fiemap_capable_ check
* tests/cp/fiemap-2: Enable the fiemap check for files, which
will enable the test on ext3.
* tests/cp/fiemap-perf: Comment why we're not enabling for ext3.
* tests/cp/sparse-fiemap: Ditto.
* tests/fiemap-capable: A new python script to determine
if a specified path supports fiemap.
* tests/init.cfg (fiemap_capable_): Use the new python script.
* tests/Makefile.am (EXTRA_DIST): Include the new python script.
---
tests/Makefile.am | 1 +
tests/cp/fiemap-2 | 3 ++-
tests/cp/fiemap-perf | 2 ++
tests/cp/sparse-fiemap | 12 ++++++++----
tests/fiemap-capable | 16 ++++++++++++++++
tests/init.cfg | 9 ++++-----
6 files changed, 33 insertions(+), 10 deletions(-)
create mode 100644 tests/fiemap-capable
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 751b327..8aa56cd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -11,6 +11,7 @@ EXTRA_DIST = \
check.mk \
envvar-check \
filefrag-extent-compare \
+ fiemap-capable \
init.cfg \
init.sh \
lang-default \
diff --git a/tests/cp/fiemap-2 b/tests/cp/fiemap-2
index a17076c..691ead2 100755
--- a/tests/cp/fiemap-2
+++ b/tests/cp/fiemap-2
@@ -20,7 +20,8 @@
print_ver_ cp
# Require a fiemap-enabled FS.
-fiemap_capable_ . \
+touch fiemap_chk # check a file rather than current dir for best coverage
+fiemap_capable_ fiemap_chk \
|| skip_ "this file system lacks FIEMAP support"
# Exercise the code that handles a file ending in a hole.
diff --git a/tests/cp/fiemap-perf b/tests/cp/fiemap-perf
index 7369a7d..dbb2a81 100755
--- a/tests/cp/fiemap-perf
+++ b/tests/cp/fiemap-perf
@@ -20,6 +20,8 @@
print_ver_ cp
# Require a fiemap-enabled FS.
+# Note we don't check a file here as that could enable
+# the test on ext3 where emulated extent scanning can be slow.
fiemap_capable_ . \
|| skip_ "this file system lacks FIEMAP support"
diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap
index f224b5b..fc27869 100755
--- a/tests/cp/sparse-fiemap
+++ b/tests/cp/sparse-fiemap
@@ -19,6 +19,8 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ cp
+# Note we don't check a file here as that could enable
+# the test on ext3 where this test is seen to fail.
if fiemap_capable_ . ; then
: # Current dir is on a partition with working extents. Good!
else
@@ -66,11 +68,13 @@ for i in $(seq 1 2 21); do
$PERL -e 'BEGIN { $n = '$i' * 1024; *F = *STDOUT }' \
-e 'for (1..'$j') { sysseek (*F, $n, 1)' \
-e '&& syswrite (*F, chr($_)x$n) or die "$!"}' > j1 || fail=1
- # sync
+
+ # Note the explicit fdatasync is used here as
+ # it was seen that `filefrag -s` (FIEMAP_FLAG_SYNC) was
+ # ineffective on ext4 loopback on Linux 2.6.35.10-72.fc14.i686
+ dd if=/dev/null of=j1 conv=notrunc,fdatasync
cp --sparse=always j1 j2 || fail=1
- # sync
- # Technically we may need the 'sync' uses above, but
- # uncommenting them makes this test take much longer.
+ dd if=/dev/null of=j2 conv=notrunc,fdatasync
cmp j1 j2 || fail=1
filefrag -v j1 | grep extent \
diff --git a/tests/fiemap-capable b/tests/fiemap-capable
new file mode 100644
index 0000000..05c6926
--- /dev/null
+++ b/tests/fiemap-capable
@@ -0,0 +1,16 @@
+import struct, fcntl, sys, os
+
+def sizeof(t): return struct.calcsize(t)
+IOCPARM_MASK = 0x7f
+IOC_OUT = 0x40000000
+IOC_IN = 0x80000000
+IOC_INOUT = (IOC_IN|IOC_OUT)
+def _IOWR(x,y,t): return (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y)
+
+try:
+ fd = os.open (len (sys.argv) == 2 and sys.argv[1] or '.', os.O_RDONLY)
+ struct_fiemap = '=qqllll'
+ FS_IOC_FIEMAP = _IOWR (ord ('f'), 11, struct_fiemap)
+ fcntl.ioctl (fd, FS_IOC_FIEMAP, struct.pack(struct_fiemap, 0,~0,0,0,0,0))
+except:
+ sys.exit (1)
diff --git a/tests/init.cfg b/tests/init.cfg
index b2d1bab..f49c5cf 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -295,13 +295,12 @@ require_proc_pid_status_()
kill $pid
}
-# Return nonzero if the specified directory is on a file system for
-# which FIEMAP support exists, and the file system type is new enough
-# (unlike ext2 and ext3) that it is hard to find an instance *without*
-# FIEMAP support.
+# Return nonzero if the specified path is on a file system for
+# which FIEMAP support exists. Note some file systems (like ext3)
+# only support FIEMAP for files, not directories.
fiemap_capable_()
{
- df -T -t btrfs -t xfs -t ext4 -t ocfs2 -t gfs2 "$@"
+ python $abs_srcdir/fiemap-capable "$@"
}
# Does the current (working-dir) file system support sparse files?
--
1.7.3.4
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page