fstests: random fixes
cover fstests: random fixes
Hi all,
Here's a few patches to fix various bugs in the test suite that cause test failures.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=random-fixes
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=random-fixes
PATCH 1/2 xfs/435: disable dmesg checks
From: Darrick J. Wong <[email protected]>
This test corrupts the filesystem to see what assertions and other things to get logged, so don't treat that as a failure.
--- tests/xfs/435 | 1 + 1 file changed, 1 insertion(+)
tests/xfs/435 +1 -0
@@ -42,6 +42,7 @@ _require_loadable_fs_module "xfs" _require_quota _require_scratch_reflink _require_cp_reflink +_disable_dmesg_check rm -f "$seqres.full"
PATCH 2/2 xfs: make sure the kernel and repair tools catch bad names
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Make sure we actually catch bad names in the kernel.
--- tests/xfs/749 | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/749.out | 4 ++ tests/xfs/group | 1 + 3 files changed, 108 insertions(+) create mode 100755 tests/xfs/749 create mode 100644 tests/xfs/749.out
tests/xfs/749 new file +103 -0
@@ -0,0 +1,103 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-newer +# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 749 +# +# See if we catch corrupt directory names or attr names with nulls or slashes +# in them. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + umount $mntpt > /dev/null 2>&1 + test -n "$loopdev" && _destroy_loop_device $loopdev > /dev/null 2>&1 + rm -r -f $imgfile $mntpt $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_test + +rm -f $seqres.full + +imgfile=$TEST_DIR/img-$seq +mntpt=$TEST_DIR/mount-$seq +testdir=$mntpt/testdir +testfile=$mntpt/testfile +nullstr="too_many_beans" +slashstr="are_bad_for_you" + +# Format image file +truncate -s 40m $imgfile +loopdev=$(_create_loop_device $imgfile) +$MKFS_XFS_PROG $loopdev >> $seqres.full + +# Mount image file +mkdir -p $mntpt +mount $loopdev $mntpt + +# Create directory entries +mkdir -p $testdir +touch $testdir/$nullstr +touch $testdir/$slashstr + +# Create attrs +touch $testfile +$ATTR_PROG -s $nullstr -V heh $testfile >> $seqres.full +$ATTR_PROG -s $slashstr -V heh $testfile >> $seqres.full + +# Corrupt the entries +umount $mntpt +_destroy_loop_device $loopdev +cp $imgfile $imgfile.old +sed -b \ + -e "s/$nullstr/too_many\x00beans/g" \ + -e "s/$slashstr/are_bad\/for_you/g" \ + -i $imgfile +test "$(md5sum < $imgfile)" != "$(md5sum < $imgfile.old)" || + _fail "sed failed to change the image file?" +rm -f $imgfile.old +loopdev=$(_create_loop_device $imgfile) +mount $loopdev $mntpt + +# Try to access the corrupt metadata +ls $testdir >> $seqres.full 2> $tmp.err +attr -l $testfile >> $seqres.full 2>> $tmp.err +cat $tmp.err | _filter_test_dir + +# Does scrub complain about this? +if _supports_xfs_scrub $mntpt $loopdev; then + $XFS_SCRUB_PROG -n $mntpt >> $seqres.full 2>&1 + res=$? + test $((res & 1)) -eq 0 && \ + echo "scrub failed to report corruption ($res)" +fi + +# Does repair complain about this? +umount $mntpt +$XFS_REPAIR_PROG -n $loopdev >> $seqres.full 2>&1 +res=$? +test $res -eq 1 || \ + echo "repair failed to report corruption ($res)" + +_destroy_loop_device $loopdev +loopdev= + +# success, all done +status=0 +exit
tests/xfs/749.out new file +4 -0
@@ -0,0 +1,4 @@ +QA output created by 749 +ls: cannot access 'TEST_DIR/mount-749/testdir': Structure needs cleaning +attr_list: Structure needs cleaning +Could not list "(null)" for TEST_DIR/mount-749/testfile
tests/xfs/group +1 -0
@@ -507,3 +507,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +749 auto quick fuzzers
Re: [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names
Quoted 32 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Make sure we actually catch bad names in the kernel.
Signed-off-by Darrick J. Wong <[email protected]>--- tests/xfs/749 | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/749.out | 4 ++ tests/xfs/group | 1 + 3 files changed, 108 insertions(+) create mode 100755 tests/xfs/749 create mode 100644 tests/xfs/749.outtests/xfs/749 new file +12
-0@@ -0,0 +1,103 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-newer +# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 749 +# +# See if we catch corrupt directory names or attr names with nulls or slashes +# in them. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq"
tests/xfs/749 line 22
Quoted 10 lines
tests/xfs/749 new file +10
-0+ +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + umount $mntpt > /dev/null 2>&1
$UMOUNT_PROG
tests/xfs/749 line 34
Quoted 12 lines
tests/xfs/749 new file +12
-0+ test -n "$loopdev" && _destroy_loop_device $loopdev > /dev/null 2>&1 + rm -r -f $imgfile $mntpt $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_test
_require_attrs is also needed
tests/xfs/749 line 46
Quoted 12 lines
tests/xfs/749 new file +12
-0+ +rm -f $seqres.full + +imgfile=$TEST_DIR/img-$seq +mntpt=$TEST_DIR/mount-$seq +testdir=$mntpt/testdir +testfile=$mntpt/testfile +nullstr="too_many_beans" +slashstr="are_bad_for_you" + +# Format image file +truncate -s 40m $imgfile
$XFS_IO_PROG -fc "truncate 40m" $imgfile
tests/xfs/749 line 48
Quoted 2 lines
tests/xfs/749 new file +2
-0+loopdev=$(_create_loop_device $imgfile) +$MKFS_XFS_PROG $loopdev >> $seqres.full
_mkfs_dev $loopdev ?
tests/xfs/749 line 52
Quoted 4 lines
tests/xfs/749 new file +4
-0+ +# Mount image file +mkdir -p $mntpt +mount $loopdev $mntpt
_mount $loopdev $mntpt
tests/xfs/749 line 65
Quoted 13 lines
tests/xfs/749 new file +13
-0+ +# Create directory entries +mkdir -p $testdir +touch $testdir/$nullstr +touch $testdir/$slashstr + +# Create attrs +touch $testfile +$ATTR_PROG -s $nullstr -V heh $testfile >> $seqres.full +$ATTR_PROG -s $slashstr -V heh $testfile >> $seqres.full + +# Corrupt the entries +umount $mntpt
$UMOUNT_PROG $mntpt
tests/xfs/749 line 76
Quoted 11 lines
tests/xfs/749 new file +11
-0+_destroy_loop_device $loopdev +cp $imgfile $imgfile.old +sed -b \ + -e "s/$nullstr/too_many\x00beans/g" \ + -e "s/$slashstr/are_bad\/for_you/g" \ + -i $imgfile +test "$(md5sum < $imgfile)" != "$(md5sum < $imgfile.old)" || + _fail "sed failed to change the image file?" +rm -f $imgfile.old +loopdev=$(_create_loop_device $imgfile) +mount $loopdev $mntpt
_mount $loopdev $mntpt
tests/xfs/749 line 80
Quoted 4 lines
tests/xfs/749 new file +4
-0+ +# Try to access the corrupt metadata +ls $testdir >> $seqres.full 2> $tmp.err +attr -l $testfile >> $seqres.full 2>> $tmp.err
$ATTR_PROG
tests/xfs/749 line 92
Quoted 12 lines
tests/xfs/749 new file +12
-0+cat $tmp.err | _filter_test_dir + +# Does scrub complain about this? +if _supports_xfs_scrub $mntpt $loopdev; then + $XFS_SCRUB_PROG -n $mntpt >> $seqres.full 2>&1 + res=$? + test $((res & 1)) -eq 0 && \ + echo "scrub failed to report corruption ($res)" +fi + +# Does repair complain about this? +umount $mntpt
$UMOUNT_PROG
Quoted 17 lines
tests/xfs/749 new file +11
-0+$XFS_REPAIR_PROG -n $loopdev >> $seqres.full 2>&1 +res=$? +test $res -eq 1 || \ + echo "repair failed to report corruption ($res)" + +_destroy_loop_device $loopdev +loopdev= + +# success, all done +status=0 +exittests/xfs/749.out new file +0
-0
tests/xfs/749.out line 4
Quoted 4 lines
tests/xfs/749.out new file +4
-0@@ -0,0 +1,4 @@ +QA output created by 749 +ls: cannot access 'TEST_DIR/mount-749/testdir': Structure needs cleaning +attr_list: Structure needs cleaning +Could not list "(null)" for TEST_DIR/mount-749/testfile
I got the following diff on my fedora 30 test vm, where attr version is attr-2.4.48-5.fc30.x86_64, perhaps the attr output has been changed? Looks like we need a filter, or use _getfattr?
-Could not list "(null)" for TEST_DIR/mount-148/testfile +Could not list TEST_DIR/mount-148/testfile
Thanks,
Eryu
Quoted 10 lines
tests/xfs/group +1
-0@@ -507,3 +507,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +749 auto quick fuzzers
Re: [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names
Quoted 125 lines · Eryu Guan
Quoted 32 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Make sure we actually catch bad names in the kernel.
Signed-off-by Darrick J. Wong <[email protected]>--- tests/xfs/749 | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/749.out | 4 ++ tests/xfs/group | 1 + 3 files changed, 108 insertions(+) create mode 100755 tests/xfs/749 create mode 100644 tests/xfs/749.outtests/xfs/749 new file +12
-0@@ -0,0 +1,103 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-newer +# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 749 +# +# See if we catch corrupt directory names or attr names with nulls or slashes +# in them. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq"tests/xfs/749 line 22
Quoted 10 lines
tests/xfs/749 new file +10
-0+ +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + umount $mntpt > /dev/null 2>&1$UMOUNT_PROG
tests/xfs/749 line 34
Quoted 12 lines
tests/xfs/749 new file +12
-0+ test -n "$loopdev" && _destroy_loop_device $loopdev > /dev/null 2>&1 + rm -r -f $imgfile $mntpt $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_test
_require_attrsis also neededtests/xfs/749 line 46
Quoted 12 lines
tests/xfs/749 new file +12
-0+ +rm -f $seqres.full + +imgfile=$TEST_DIR/img-$seq +mntpt=$TEST_DIR/mount-$seq +testdir=$mntpt/testdir +testfile=$mntpt/testfile +nullstr="too_many_beans" +slashstr="are_bad_for_you" + +# Format image file +truncate -s 40m $imgfile$XFS_IO_PROG -fc "truncate 40m" $imgfile
tests/xfs/749 line 48
Quoted 2 lines
tests/xfs/749 new file +2
-0+loopdev=$(_create_loop_device $imgfile) +$MKFS_XFS_PROG $loopdev >> $seqres.full
_mkfs_dev$loopdev ?tests/xfs/749 line 52
Quoted 4 lines
tests/xfs/749 new file +4
-0+ +# Mount image file +mkdir -p $mntpt +mount $loopdev $mntpt
_mount$loopdev $mntpttests/xfs/749 line 65
Quoted 13 lines
tests/xfs/749 new file +13
-0+ +# Create directory entries +mkdir -p $testdir +touch $testdir/$nullstr +touch $testdir/$slashstr + +# Create attrs +touch $testfile +$ATTR_PROG -s $nullstr -V heh $testfile >> $seqres.full +$ATTR_PROG -s $slashstr -V heh $testfile >> $seqres.full + +# Corrupt the entries +umount $mntpt$UMOUNT_PROG $mntpt
tests/xfs/749 line 76
Quoted 11 lines
tests/xfs/749 new file +11
-0+_destroy_loop_device $loopdev +cp $imgfile $imgfile.old +sed -b \ + -e "s/$nullstr/too_many\x00beans/g" \ + -e "s/$slashstr/are_bad\/for_you/g" \ + -i $imgfile +test "$(md5sum < $imgfile)" != "$(md5sum < $imgfile.old)" || + _fail "sed failed to change the image file?" +rm -f $imgfile.old +loopdev=$(_create_loop_device $imgfile) +mount $loopdev $mntpt
_mount$loopdev $mntpttests/xfs/749 line 80
Quoted 4 lines
tests/xfs/749 new file +4
-0+ +# Try to access the corrupt metadata +ls $testdir >> $seqres.full 2> $tmp.err +attr -l $testfile >> $seqres.full 2>> $tmp.err$ATTR_PROG
Quoted 14 lines
tests/xfs/749 line 92
Quoted 12 lines
tests/xfs/749 new file +12
-0+cat $tmp.err | _filter_test_dir + +# Does scrub complain about this? +if _supports_xfs_scrub $mntpt $loopdev; then + $XFS_SCRUB_PROG -n $mntpt >> $seqres.full 2>&1 + res=$? + test $((res & 1)) -eq 0 && \ + echo "scrub failed to report corruption ($res)" +fi + +# Does repair complain about this? +umount $mntpt$UMOUNT_PROG
Will fix all of these.
Quoted 26 lines
Quoted 17 lines
tests/xfs/749 new file +11
-0+$XFS_REPAIR_PROG -n $loopdev >> $seqres.full 2>&1 +res=$? +test $res -eq 1 || \ + echo "repair failed to report corruption ($res)" + +_destroy_loop_device $loopdev +loopdev= + +# success, all done +status=0 +exittests/xfs/749.out new file +0
-0tests/xfs/749.out line 4
Quoted 4 lines
tests/xfs/749.out new file +4
-0@@ -0,0 +1,4 @@ +QA output created by 749 +ls: cannot access 'TEST_DIR/mount-749/testdir': Structure needs cleaning +attr_list: Structure needs cleaning +Could not list "(null)" for TEST_DIR/mount-749/testfileI got the following diff on my fedora 30 test vm, where attr version is attr-2.4.48-5.fc30.x86_64, perhaps the attr output has been changed? Looks like we need a filter, or use
_getfattr?
Review
Quoted 2 lines
(quoted diff) +1
-1-Could not list "(null)" for TEST_DIR/mount-148/testfile +Could not list TEST_DIR/mount-148/testfile
How about I simply delete the line from the golden output?
--D
Quoted 13 lines
Thanks,
EryuQuoted 10 lines
tests/xfs/group +1
-0@@ -507,3 +507,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +749 auto quick fuzzers
PATCH v2 2/2 xfs: make sure the kernel and repair tools catch bad names
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Make sure we actually catch bad names in the kernel.
---
v2: fix various things as pointed out by Eryu
--- tests/xfs/749 | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/749.out | 3 ++ tests/xfs/group | 1 + 3 files changed, 110 insertions(+) create mode 100755 tests/xfs/749 create mode 100644 tests/xfs/749.out
tests/xfs/749 new file +106 -0
@@ -0,0 +1,106 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-newer +# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 749 +# +# See if we catch corrupt directory names or attr names with nulls or slashes +# in them. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + $UMOUNT_PROG $mntpt > /dev/null 2>&1 + test -n "$loopdev" && _destroy_loop_device $loopdev > /dev/null 2>&1 + rm -r -f $imgfile $mntpt $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_test +_require_attrs + +rm -f $seqres.full + +imgfile=$TEST_DIR/img-$seq +mntpt=$TEST_DIR/mount-$seq +testdir=$mntpt/testdir +testfile=$mntpt/testfile +nullstr="too_many_beans" +slashstr="are_bad_for_you" + +# Format image file +$XFS_IO_PROG -f -c 'truncate 40m' $imgfile +loopdev=$(_create_loop_device $imgfile) +_mkfs_dev $loopdev >> $seqres.full + +# Mount image file +mkdir -p $mntpt +_mount $loopdev $mntpt + +# Create directory entries +mkdir -p $testdir +touch $testdir/$nullstr +touch $testdir/$slashstr + +# Create attrs +touch $testfile +$ATTR_PROG -s $nullstr -V heh $testfile >> $seqres.full +$ATTR_PROG -s $slashstr -V heh $testfile >> $seqres.full + +# Corrupt the entries +$UMOUNT_PROG $mntpt +_destroy_loop_device $loopdev +cp $imgfile $imgfile.old +sed -b \ + -e "s/$nullstr/too_many\x00beans/g" \ + -e "s/$slashstr/are_bad\/for_you/g" \ + -i $imgfile +test "$(md5sum < $imgfile)" != "$(md5sum < $imgfile.old)" || + _fail "sed failed to change the image file?" +rm -f $imgfile.old +loopdev=$(_create_loop_device $imgfile) +_mount $loopdev $mntpt + +# Try to access the corrupt metadata +ls $testdir >> $seqres.full 2> $tmp.err +$ATTR_PROG -l $testfile >> $seqres.full 2>> $tmp.err +cat $tmp.err >> $seqres.full +cat $tmp.err | _filter_test_dir | sed -e '/Could not list/d' + +# Does scrub complain about this? +if _supports_xfs_scrub $mntpt $loopdev; then + $XFS_SCRUB_PROG -n $mntpt >> $seqres.full 2>&1 + res=$? + test $((res & 1)) -eq 0 && \ + echo "scrub failed to report corruption ($res)" +fi + +# Does repair complain about this? +$UMOUNT_PROG $mntpt +$XFS_REPAIR_PROG -n $loopdev >> $seqres.full 2>&1 +res=$? +test $res -eq 1 || \ + echo "repair failed to report corruption ($res)" + +_destroy_loop_device $loopdev +loopdev= + +# success, all done +status=0 +exit
tests/xfs/749.out new file +3 -0
@@ -0,0 +1,3 @@ +QA output created by 749 +ls: cannot access 'TEST_DIR/mount-749/testdir': Structure needs cleaning +attr_list: Structure needs cleaning
tests/xfs/group +1 -0
@@ -507,3 +507,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +749 auto quick fuzzers
Re: [PATCH v2 2/2] xfs: make sure the kernel and repair tools catch bad names
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Make sure we actually catch bad names in the kernel.
Signed-off-by Darrick J. Wong <[email protected]>---
v2: fix various things as pointed out by Eryu
Self NAK, I found some bugs in this test and withdraw this patch.
--D
Quoted 138 lines
--- tests/xfs/749 | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/749.out | 3 ++ tests/xfs/group | 1 + 3 files changed, 110 insertions(+) create mode 100755 tests/xfs/749 create mode 100644 tests/xfs/749.outtests/xfs/749 new file +106
-0@@ -0,0 +1,106 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-newer +# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 749 +# +# See if we catch corrupt directory names or attr names with nulls or slashes +# in them. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + $UMOUNT_PROG $mntpt > /dev/null 2>&1 + test -n "$loopdev" && _destroy_loop_device $loopdev > /dev/null 2>&1 + rm -r -f $imgfile $mntpt $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_test +_require_attrs + +rm -f $seqres.full + +imgfile=$TEST_DIR/img-$seq +mntpt=$TEST_DIR/mount-$seq +testdir=$mntpt/testdir +testfile=$mntpt/testfile +nullstr="too_many_beans" +slashstr="are_bad_for_you" + +# Format image file +$XFS_IO_PROG -f -c 'truncate 40m' $imgfile +loopdev=$(_create_loop_device $imgfile) +_mkfs_dev $loopdev >> $seqres.full + +# Mount image file +mkdir -p $mntpt +_mount $loopdev $mntpt + +# Create directory entries +mkdir -p $testdir +touch $testdir/$nullstr +touch $testdir/$slashstr + +# Create attrs +touch $testfile +$ATTR_PROG -s $nullstr -V heh $testfile >> $seqres.full +$ATTR_PROG -s $slashstr -V heh $testfile >> $seqres.full + +# Corrupt the entries +$UMOUNT_PROG $mntpt +_destroy_loop_device $loopdev +cp $imgfile $imgfile.old +sed -b \ + -e "s/$nullstr/too_many\x00beans/g" \ + -e "s/$slashstr/are_bad\/for_you/g" \ + -i $imgfile +test "$(md5sum < $imgfile)" != "$(md5sum < $imgfile.old)" || + _fail "sed failed to change the image file?" +rm -f $imgfile.old +loopdev=$(_create_loop_device $imgfile) +_mount $loopdev $mntpt + +# Try to access the corrupt metadata +ls $testdir >> $seqres.full 2> $tmp.err +$ATTR_PROG -l $testfile >> $seqres.full 2>> $tmp.err +cat $tmp.err >> $seqres.full +cat $tmp.err | _filter_test_dir | sed -e '/Could not list/d' + +# Does scrub complain about this? +if _supports_xfs_scrub $mntpt $loopdev; then + $XFS_SCRUB_PROG -n $mntpt >> $seqres.full 2>&1 + res=$? + test $((res & 1)) -eq 0 && \ + echo "scrub failed to report corruption ($res)" +fi + +# Does repair complain about this? +$UMOUNT_PROG $mntpt +$XFS_REPAIR_PROG -n $loopdev >> $seqres.full 2>&1 +res=$? +test $res -eq 1 || \ + echo "repair failed to report corruption ($res)" + +_destroy_loop_device $loopdev +loopdev= + +# success, all done +status=0 +exittests/xfs/749.out new file +3
-0@@ -0,0 +1,3 @@ +QA output created by 749 +ls: cannot access 'TEST_DIR/mount-749/testdir': Structure needs cleaning +attr_list: Structure needs cleaningtests/xfs/group +1
-0@@ -507,3 +507,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +749 auto quick fuzzers
[PATCH 3/2] generic: check storing and re-reading timestamps
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Add a test to make sure that we can store and retrieve timestamps without corrupting them. Note that this is likely to fail on older kernels that do not clamp timestamps properly, though at least in my book that counts as corruption.
--- tests/generic/721 | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/721.out | 1 tests/generic/group | 1 3 files changed, 104 insertions(+) create mode 100755 tests/generic/721 create mode 100644 tests/generic/721.out
tests/generic/721 new file +102 -0
@@ -0,0 +1,102 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2019, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 721 +# +# Make sure we can store and retrieve timestamps on the extremes of the +# supported date ranges. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc + +# real QA test starts here +_supported_os Linux +_supported_fs generic +_require_scratch + +rm -f $seqres.full + +_scratch_mkfs > $seqres.full +_scratch_mount + +# Does our userspace even support large dates? +test_bigdates=1 +touch -d 'May 30 01:53:03 UTC 2514' $SCRATCH_MNT 2>/dev/null || test_bigdates=0 + +# And can we do statx? +test_statx=1 +($XFS_IO_PROG -c 'help statx' | grep -q 'Print raw statx' && \ + $XFS_IO_PROG -c 'statx -r' $SCRATCH_MNT 2>/dev/null | grep -q 'stat.mtime') || \ + test_statx=0 + +echo "Userspace support of large timestamps: $test_bigdates" >> $seqres.full +echo "xfs_io support of statx: $test_statx" >> $seqres.full + +touchme() { + local arg="$1" + local name="$2" + + touch -d "$arg" $SCRATCH_MNT/t_$name +} + +report() { + local files=($SCRATCH_MNT $SCRATCH_MNT/t_*) + TZ=UTC stat -c '%y %Y %n' "${files[@]}" + test $test_statx -gt 0 && \ + $XFS_IO_PROG -c 'statx -r' "${files[@]}" | grep 'stat.mtime' +} + +# -2147483648 (S32_MIN, or classic unix min) +touchme 'Dec 13 20:45:52 UTC 1901' s32_min + +# 2147483647 (S32_MAX, or classic unix max) +touchme 'Jan 19 03:14:07 UTC 2038' s32_max + +if [ $test_bigdates -gt 0 ]; then + # 15032385535 (u34 time if you start from s32_min, like ext4 does) + touchme 'May 10 22:38:55 UTC 2446' u34_from_s32_min + + # 17179869183 (u34 time if you start from the unix epoch) + touchme 'May 30 01:53:03 UTC 2514' u34_max + + # Latest date we can synthesize(?) + touchme 'Dec 31 23:59:59 UTC 2147483647' abs_max_time + + # Earliest date we can synthesize(?) + touchme 'Jan 1 00:00:00 UTC 0' abs_min_time +fi + +# Query timestamps from incore +echo before >> $seqres.full +report > $tmp.times0 +cat $tmp.times0 >> $seqres.full + +_scratch_cycle_mount + +# Query timestamps from disk +echo after >> $seqres.full +report > $tmp.times1 +cat $tmp.times1 >> $seqres.full + +# Did they match? +cmp -s $tmp.times0 $tmp.times1 + +# success, all done +status=0 +exit
tests/generic/721.out new file +1 -0
@@ -0,0 +1 @@ +QA output created by 721
tests/generic/group +1 -0
@@ -581,3 +581,4 @@ 576 auto quick verity encrypt 577 auto quick verity 578 auto quick rw clone +721 auto quick atime