From: Eryu Guan <eguan@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: test the per-inode DAX flag
Date: Mon, 4 Sep 2017 15:24:31 +0800 [thread overview]
Message-ID: <20170904072431.GW27835@eguan.usersys.redhat.com> (raw)
In-Reply-To: <20170903093325.GA16272@lst.de>
On Sun, Sep 03, 2017 at 11:33:25AM +0200, Christoph Hellwig wrote:
> This tests checks that the per-inode DAX flag is either reject
> or sticks around, and that rapidly setting/clearing it will not
> crash the kernel.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Does this test make sense when filesystem was mounted without dax
option? I saw these failures when testing on normal block device without
dax mount option.
--- tests/xfs/115.out 2017-09-04 11:45:11.628000000 +0800
+++ /root/workspace/xfstests/results//xfs_4k_crc/xfs/115.out.bad 2017-09-04 15:05:19.433000000 +0800
@@ -1,4 +1,1004 @@
QA output created by 115
checking for DAX flag:
--------------x- TEST_DIR/test.115
+xfs_io: cannot set flags on /mnt/testarea/test/test.115: Input/output error
+./tests/xfs/115: line 82: 15344 Bus error $here/ltp/fsx -N 1000 $file > $tmp.log 2>&1
+xfs_io: cannot set flags on /mnt/testarea/test/test.115: Input/output error
+xfs_io: cannot set flags on /mnt/testarea/test/test.115: Input/output error
...
If not, I think we need a new _require_test_dax rule similar to
_require_scratch_dax.
>
> diff --git a/tests/xfs/115 b/tests/xfs/115
> new file mode 100755
> index 0000000..4b6472f
> --- /dev/null
> +++ b/tests/xfs/115
> @@ -0,0 +1,92 @@
> +#! /bin/bash
> +# FS QA Test 115
> +#
> +# Test that the DAX xflag works, and rapidly setting/clearing it doesn't
> +# crash the kernel
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2017 Christoph Hellwig. All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> +#-----------------------------------------------------------------------
> +#
> +
> +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
> +
> +file=$TEST_DIR/test.$seq
> +
> +_lets_get_pidst()
Better to name local functions without the leading underscore.
> +{
> + if [ -n "$pid" ]; then
> + kill -TERM $pid 2>/dev/null
> + pid=""
> + wait 2>/dev/null
> + fi
> +}
> +
> +_cleanup()
> +{
> + cd /
> + _lets_get_pidst
> + rm -f $tmp.*
> + rm -f $file*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +_supported_fs xfs
> +_supported_os Linux
> +_require_test
> +
> +# test that the +x flag sticks if we don't get an error
> +touch $file
> +xfs_io -c 'chattr +x' $file > $tmp.log 2>&1
> +if grep -q "Invalid argument" $tmp.log; then
> + _notrun "file system doesn't support the DAX flag"
> +fi
I think we can add an "chattr" entry in _require_xfs_io_command, and
actually run chattr command with the given option (-x in this case) to
check the xflag support status. (Then the _require_xfs_io_command usage
in xfs/260 should be fixed.)
> +
> +echo "checking for DAX flag:"
> +xfs_io -c 'lsattr' $file | _filter_test_dir
$XFS_IO_PROG
> +rm -f $file
> +
> +# run fsx racing with setting/clearing the DAX flag
> +$here/ltp/fsx -N 1000 $file > $tmp.log 2>&1 &
> +pid=$!
> +
> +for i in `seq 1 1000`; do
> + xfs_io -c 'chattr +x' $file
> + xfs_io -c 'chattr -x' $file
> +done
> +
> +_lets_get_pidst
> +
> +# success, all done
> +echo "*** done"
> +status=0
> +exit
> diff --git a/tests/xfs/115.out b/tests/xfs/115.out
> new file mode 100644
> index 0000000..652276a
> --- /dev/null
> +++ b/tests/xfs/115.out
> @@ -0,0 +1,4 @@
> +QA output created by 115
> +checking for DAX flag:
> +--------------x- TEST_DIR/test.115
> +*** done
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 5977330..5c02498 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -111,6 +111,7 @@
> 112 fuzzers
> 113 fuzzers
> 114 auto quick clone rmap
> +115 auto rw dangerous
Sometimes test passed for me without triggering any crashes, and it
finished within 10 seconds, can be a 'quick' test too.
Thanks,
Eryu
> 116 quota auto quick
> 117 fuzzers
> 118 auto quick fsr dangerous
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-09-04 7:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-03 9:33 test the per-inode DAX flag Christoph Hellwig
2017-09-04 7:24 ` Eryu Guan [this message]
2017-09-04 15:44 ` Christoph Hellwig
2017-09-06 14:50 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170904072431.GW27835@eguan.usersys.redhat.com \
--to=eguan@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox