* [PATCH 0/2] fstests: random fixes @ 2019-10-22 1:49 Darrick J. Wong 2019-10-22 1:49 ` [PATCH 1/2] xfs/435: disable dmesg checks Darrick J. Wong ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Darrick J. Wong @ 2019-10-22 1:49 UTC (permalink / raw) To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] xfs/435: disable dmesg checks 2019-10-22 1:49 [PATCH 0/2] fstests: random fixes Darrick J. Wong @ 2019-10-22 1:49 ` Darrick J. Wong 2019-10-22 1:49 ` [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names Darrick J. Wong 2019-10-24 0:33 ` [PATCH 3/2] generic: check storing and re-reading timestamps Darrick J. Wong 2 siblings, 0 replies; 8+ messages in thread From: Darrick J. Wong @ 2019-10-22 1:49 UTC (permalink / raw) To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests From: Darrick J. Wong <darrick.wong@oracle.com> This test corrupts the filesystem to see what assertions and other things to get logged, so don't treat that as a failure. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- tests/xfs/435 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/435 b/tests/xfs/435 index c6c846ad..7af63158 100755 --- a/tests/xfs/435 +++ b/tests/xfs/435 @@ -42,6 +42,7 @@ _require_loadable_fs_module "xfs" _require_quota _require_scratch_reflink _require_cp_reflink +_disable_dmesg_check rm -f "$seqres.full" ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names 2019-10-22 1:49 [PATCH 0/2] fstests: random fixes Darrick J. Wong 2019-10-22 1:49 ` [PATCH 1/2] xfs/435: disable dmesg checks Darrick J. Wong @ 2019-10-22 1:49 ` Darrick J. Wong 2019-10-23 15:45 ` Eryu Guan 2019-10-24 0:31 ` [PATCH v2 " Darrick J. Wong 2019-10-24 0:33 ` [PATCH 3/2] generic: check storing and re-reading timestamps Darrick J. Wong 2 siblings, 2 replies; 8+ messages in thread From: Darrick J. Wong @ 2019-10-22 1:49 UTC (permalink / raw) To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests From: Darrick J. Wong <darrick.wong@oracle.com> Make sure we actually catch bad names in the kernel. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- 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 diff --git a/tests/xfs/749 b/tests/xfs/749 new file mode 100755 index 00000000..de219979 --- /dev/null +++ b/tests/xfs/749 @@ -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 diff --git a/tests/xfs/749.out b/tests/xfs/749.out new file mode 100644 index 00000000..db704c87 --- /dev/null +++ b/tests/xfs/749.out @@ -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 diff --git a/tests/xfs/group b/tests/xfs/group index f4ebcd8c..9600cb4e 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -507,3 +507,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +749 auto quick fuzzers ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names 2019-10-22 1:49 ` [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names Darrick J. Wong @ 2019-10-23 15:45 ` Eryu Guan 2019-10-24 0:30 ` Darrick J. Wong 2019-10-24 0:31 ` [PATCH v2 " Darrick J. Wong 1 sibling, 1 reply; 8+ messages in thread From: Eryu Guan @ 2019-10-23 15:45 UTC (permalink / raw) To: Darrick J. Wong; +Cc: linux-xfs, fstests On Mon, Oct 21, 2019 at 06:49:52PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@oracle.com> > > Make sure we actually catch bad names in the kernel. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > 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 > > > diff --git a/tests/xfs/749 b/tests/xfs/749 > new file mode 100755 > index 00000000..de219979 > --- /dev/null > +++ b/tests/xfs/749 > @@ -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 $UMOUNT_PROG > + 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 > + > +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 > +loopdev=$(_create_loop_device $imgfile) > +$MKFS_XFS_PROG $loopdev >> $seqres.full _mkfs_dev $loopdev ? > + > +# Mount image file > +mkdir -p $mntpt > +mount $loopdev $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 $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 _mount $loopdev $mntpt > + > +# Try to access the corrupt metadata > +ls $testdir >> $seqres.full 2> $tmp.err > +attr -l $testfile >> $seqres.full 2>> $tmp.err $ATTR_PROG > +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 > +$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 > diff --git a/tests/xfs/749.out b/tests/xfs/749.out > new file mode 100644 > index 00000000..db704c87 > --- /dev/null > +++ b/tests/xfs/749.out > @@ -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 > diff --git a/tests/xfs/group b/tests/xfs/group > index f4ebcd8c..9600cb4e 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -507,3 +507,4 @@ > 509 auto ioctl > 510 auto ioctl quick > 511 auto quick quota > +749 auto quick fuzzers > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names 2019-10-23 15:45 ` Eryu Guan @ 2019-10-24 0:30 ` Darrick J. Wong 0 siblings, 0 replies; 8+ messages in thread From: Darrick J. Wong @ 2019-10-24 0:30 UTC (permalink / raw) To: Eryu Guan; +Cc: linux-xfs, fstests On Wed, Oct 23, 2019 at 11:45:57PM +0800, Eryu Guan wrote: > On Mon, Oct 21, 2019 at 06:49:52PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <darrick.wong@oracle.com> > > > > Make sure we actually catch bad names in the kernel. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > 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 > > > > > > diff --git a/tests/xfs/749 b/tests/xfs/749 > > new file mode 100755 > > index 00000000..de219979 > > --- /dev/null > > +++ b/tests/xfs/749 > > @@ -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 > > $UMOUNT_PROG > > > + 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 > > > + > > +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 > > > +loopdev=$(_create_loop_device $imgfile) > > +$MKFS_XFS_PROG $loopdev >> $seqres.full > > _mkfs_dev $loopdev ? > > > + > > +# Mount image file > > +mkdir -p $mntpt > > +mount $loopdev $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 > > $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 > > _mount $loopdev $mntpt > > > + > > +# Try to access the corrupt metadata > > +ls $testdir >> $seqres.full 2> $tmp.err > > +attr -l $testfile >> $seqres.full 2>> $tmp.err > > $ATTR_PROG > > > +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. > > +$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 > > diff --git a/tests/xfs/749.out b/tests/xfs/749.out > > new file mode 100644 > > index 00000000..db704c87 > > --- /dev/null > > +++ b/tests/xfs/749.out > > @@ -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 How about I simply delete the line from the golden output? --D > Thanks, > Eryu > > > diff --git a/tests/xfs/group b/tests/xfs/group > > index f4ebcd8c..9600cb4e 100644 > > --- a/tests/xfs/group > > +++ b/tests/xfs/group > > @@ -507,3 +507,4 @@ > > 509 auto ioctl > > 510 auto ioctl quick > > 511 auto quick quota > > +749 auto quick fuzzers > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 2/2] xfs: make sure the kernel and repair tools catch bad names 2019-10-22 1:49 ` [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names Darrick J. Wong 2019-10-23 15:45 ` Eryu Guan @ 2019-10-24 0:31 ` Darrick J. Wong 2019-10-24 4:52 ` Darrick J. Wong 1 sibling, 1 reply; 8+ messages in thread From: Darrick J. Wong @ 2019-10-24 0:31 UTC (permalink / raw) To: guaneryu; +Cc: linux-xfs, fstests From: Darrick J. Wong <darrick.wong@oracle.com> Make sure we actually catch bad names in the kernel. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- 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 diff --git a/tests/xfs/749 b/tests/xfs/749 new file mode 100755 index 00000000..e8371351 --- /dev/null +++ b/tests/xfs/749 @@ -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 diff --git a/tests/xfs/749.out b/tests/xfs/749.out new file mode 100644 index 00000000..db3b1beb --- /dev/null +++ b/tests/xfs/749.out @@ -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 diff --git a/tests/xfs/group b/tests/xfs/group index f4ebcd8c..9600cb4e 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -507,3 +507,4 @@ 509 auto ioctl 510 auto ioctl quick 511 auto quick quota +749 auto quick fuzzers ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/2] xfs: make sure the kernel and repair tools catch bad names 2019-10-24 0:31 ` [PATCH v2 " Darrick J. Wong @ 2019-10-24 4:52 ` Darrick J. Wong 0 siblings, 0 replies; 8+ messages in thread From: Darrick J. Wong @ 2019-10-24 4:52 UTC (permalink / raw) To: guaneryu; +Cc: linux-xfs, fstests On Wed, Oct 23, 2019 at 05:31:06PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@oracle.com> > > Make sure we actually catch bad names in the kernel. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > v2: fix various things as pointed out by Eryu Self NAK, I found some bugs in this test and withdraw this patch. --D > --- > 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 > > diff --git a/tests/xfs/749 b/tests/xfs/749 > new file mode 100755 > index 00000000..e8371351 > --- /dev/null > +++ b/tests/xfs/749 > @@ -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 > diff --git a/tests/xfs/749.out b/tests/xfs/749.out > new file mode 100644 > index 00000000..db3b1beb > --- /dev/null > +++ b/tests/xfs/749.out > @@ -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 > diff --git a/tests/xfs/group b/tests/xfs/group > index f4ebcd8c..9600cb4e 100644 > --- a/tests/xfs/group > +++ b/tests/xfs/group > @@ -507,3 +507,4 @@ > 509 auto ioctl > 510 auto ioctl quick > 511 auto quick quota > +749 auto quick fuzzers ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/2] generic: check storing and re-reading timestamps 2019-10-22 1:49 [PATCH 0/2] fstests: random fixes Darrick J. Wong 2019-10-22 1:49 ` [PATCH 1/2] xfs/435: disable dmesg checks Darrick J. Wong 2019-10-22 1:49 ` [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names Darrick J. Wong @ 2019-10-24 0:33 ` Darrick J. Wong 2 siblings, 0 replies; 8+ messages in thread From: Darrick J. Wong @ 2019-10-24 0:33 UTC (permalink / raw) To: guaneryu; +Cc: linux-xfs, fstests, Allison Collins From: Darrick J. Wong <darrick.wong@oracle.com> 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. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- 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 diff --git a/tests/generic/721 b/tests/generic/721 new file mode 100755 index 00000000..711d3c5f --- /dev/null +++ b/tests/generic/721 @@ -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 diff --git a/tests/generic/721.out b/tests/generic/721.out new file mode 100644 index 00000000..087decb5 --- /dev/null +++ b/tests/generic/721.out @@ -0,0 +1 @@ +QA output created by 721 diff --git a/tests/generic/group b/tests/generic/group index 6f9c4e12..a49d4b11 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -581,3 +581,4 @@ 576 auto quick verity encrypt 577 auto quick verity 578 auto quick rw clone +721 auto quick atime ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-10-24 4:52 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-10-22 1:49 [PATCH 0/2] fstests: random fixes Darrick J. Wong 2019-10-22 1:49 ` [PATCH 1/2] xfs/435: disable dmesg checks Darrick J. Wong 2019-10-22 1:49 ` [PATCH 2/2] xfs: make sure the kernel and repair tools catch bad names Darrick J. Wong 2019-10-23 15:45 ` Eryu Guan 2019-10-24 0:30 ` Darrick J. Wong 2019-10-24 0:31 ` [PATCH v2 " Darrick J. Wong 2019-10-24 4:52 ` Darrick J. Wong 2019-10-24 0:33 ` [PATCH 3/2] generic: check storing and re-reading timestamps Darrick J. Wong
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.