diff mbox

[v2] generic: concurrent IO test with mixed IO types

Message ID 1433767271-30562-1-git-send-email-eguan@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eryu Guan June 8, 2015, 12:41 p.m. UTC
Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
same files.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---

This fio job file has been proven to be potent, it triggers WARNINGs on ext4
and xfs with 4.1-rc6 kernel.

ext4: WARNING: at fs/ext4/inode.c:1328
xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()

The ext4 issue should be fixed by Lukas's patch
ext4: fix reservation release on invalidatepage for delalloc fs

And it ever paniced kernel in mm code and hung xfs.

I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
and xfs with reduced workload.

v2:
- use mktemp to create tmp fio job file

 tests/generic/090     | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/090.out |   2 +
 tests/generic/group   |   1 +
 3 files changed, 123 insertions(+)
 create mode 100755 tests/generic/090
 create mode 100644 tests/generic/090.out

Comments

Lukas Czerner June 9, 2015, 8:39 a.m. UTC | #1
On Mon, 8 Jun 2015, Eryu Guan wrote:

> Date: Mon,  8 Jun 2015 20:41:11 +0800
> From: Eryu Guan <eguan@redhat.com>
> To: fstests@vger.kernel.org
> Cc: lczerner@redhat.com, Eryu Guan <eguan@redhat.com>
> Subject: [PATCH v2] generic: concurrent IO test with mixed IO types
> 
> Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> same files.

Great, it looks good to me. Thanks!

Reviewed-by: Lukas Czerner <lczerner@redhat.com>


> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
> 
> This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> and xfs with 4.1-rc6 kernel.
> 
> ext4: WARNING: at fs/ext4/inode.c:1328
> xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> 
> The ext4 issue should be fixed by Lukas's patch
> ext4: fix reservation release on invalidatepage for delalloc fs
> 
> And it ever paniced kernel in mm code and hung xfs.
> 
> I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> and xfs with reduced workload.
> 
> v2:
> - use mktemp to create tmp fio job file
> 
>  tests/generic/090     | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/090.out |   2 +
>  tests/generic/group   |   1 +
>  3 files changed, 123 insertions(+)
>  create mode 100755 tests/generic/090
>  create mode 100644 tests/generic/090.out
> 
> diff --git a/tests/generic/090 b/tests/generic/090
> new file mode 100755
> index 0000000..3521cd4
> --- /dev/null
> +++ b/tests/generic/090
> @@ -0,0 +1,120 @@
> +#! /bin/bash
> +# FS QA Test generic/090
> +#
> +# Concurrent mixed I/O (buffer I/O, aiodio, mmap, splice) on the same files
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2015 Red Hat Inc. 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`
> +fio_config=`mktemp`
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -f $fio_config
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +_require_scratch
> +
> +iodepth=$((16 * LOAD_FACTOR))
> +iodepth_batch=$((8 * LOAD_FACTOR))
> +numjobs=$((5 * LOAD_FACTOR))
> +cat >$fio_config <<EOF
> +[global]
> +bs=8k
> +iodepth=$iodepth
> +iodepth_batch=$iodepth_batch
> +randrepeat=1
> +size=1m
> +directory=$SCRATCH_MNT
> +numjobs=$numjobs
> +[job1]
> +ioengine=sync
> +bs=1k
> +direct=1
> +rw=randread
> +filename=file1:file2
> +[job2]
> +ioengine=libaio
> +rw=randwrite
> +direct=1
> +filename=file1:file2
> +[job3]
> +bs=1k
> +ioengine=posixaio
> +rw=randwrite
> +direct=1
> +filename=file1:file2
> +[job4]
> +ioengine=splice
> +direct=1
> +rw=randwrite
> +filename=file1:file2
> +[job5]
> +bs=1k
> +ioengine=sync
> +rw=randread
> +filename=file1:file2
> +[job6]
> +ioengine=posixaio
> +rw=randwrite
> +filename=file1:file2
> +[job7]
> +ioengine=splice
> +rw=randwrite
> +filename=file1:file2
> +[job8]
> +ioengine=mmap
> +rw=randwrite
> +bs=1k
> +filename=file1:file2
> +[job9]
> +ioengine=mmap
> +rw=randwrite
> +direct=1
> +filename=file1:file2
> +EOF
> +# with ioengine=mmap and direct=1, fio requires bs to be at least pagesize,
> +# which is a fio built-in var.
> +echo 'bs=$pagesize' >> $fio_config
> +
> +rm -f $seqres.full
> +
> +_require_fio $fio_config
> +
> +echo "Silence is golden"
> +$FIO_PROG $fio_config >>$seqres.full 2>&1
> +
> +# all done, expect no hang no oops no fs corruption,
> +# _check_dmesg and _check_filesystems will do the check work for us
> +status=0
> +exit
> diff --git a/tests/generic/090.out b/tests/generic/090.out
> new file mode 100644
> index 0000000..2b5100d
> --- /dev/null
> +++ b/tests/generic/090.out
> @@ -0,0 +1,2 @@
> +QA output created by 090
> +Silence is golden
> diff --git a/tests/generic/group b/tests/generic/group
> index 0c8964c..2e534a5 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -92,6 +92,7 @@
>  087 perms auto quick
>  088 perms auto quick
>  089 metadata auto
> +090 auto rw stress
>  091 rw auto quick
>  092 auto quick prealloc
>  093 attr cap udf auto
> 
--
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
Dave Chinner June 9, 2015, 10:29 p.m. UTC | #2
On Mon, Jun 08, 2015 at 08:41:11PM +0800, Eryu Guan wrote:
> Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> same files.
> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
> 
> This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> and xfs with 4.1-rc6 kernel.
> 
> ext4: WARNING: at fs/ext4/inode.c:1328
> xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> 
> The ext4 issue should be fixed by Lukas's patch
> ext4: fix reservation release on invalidatepage for delalloc fs
> 
> And it ever paniced kernel in mm code and hung xfs.
> 
> I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> and xfs with reduced workload.
> 
> v2:
> - use mktemp to create tmp fio job file
....
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +fio_config=`mktemp`
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15

By removing the definition of $tmp, you are now dumping all
the temporary files the test harnes creates in /.

> +_cleanup()
> +{
> +	cd /
> +	rm -f $fio_config
> +}

And now not removing them when the test complests...

Cheers,

Dave.
Eryu Guan June 10, 2015, 7:07 a.m. UTC | #3
On Wed, Jun 10, 2015 at 08:29:33AM +1000, Dave Chinner wrote:
> On Mon, Jun 08, 2015 at 08:41:11PM +0800, Eryu Guan wrote:
> > Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> > same files.
> > 
> > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > ---
> > 
> > This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> > and xfs with 4.1-rc6 kernel.
> > 
> > ext4: WARNING: at fs/ext4/inode.c:1328
> > xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> > 
> > The ext4 issue should be fixed by Lukas's patch
> > ext4: fix reservation release on invalidatepage for delalloc fs
> > 
> > And it ever paniced kernel in mm code and hung xfs.
> > 
> > I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> > and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> > and xfs with reduced workload.
> > 
> > v2:
> > - use mktemp to create tmp fio job file
> ....
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +fio_config=`mktemp`
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> 
> By removing the definition of $tmp, you are now dumping all
> the temporary files the test harnes creates in /.

You're right, I see /fsck.log on my test host.

I checked 'check' and common/rc and chech has its "tmp=/tmp/$$"
definition and I thought I didn't use any functions from common/rc in my
test directly that depends on $tmp definition. I must have missed
something.

Should I send a v3 and roll back to v1? or you can just take v1?

Thanks,
Eryu
--
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
Lukas Czerner June 10, 2015, 9:01 a.m. UTC | #4
On Wed, 10 Jun 2015, Dave Chinner wrote:

> Date: Wed, 10 Jun 2015 08:29:33 +1000
> From: Dave Chinner <david@fromorbit.com>
> To: Eryu Guan <eguan@redhat.com>
> Cc: fstests@vger.kernel.org, lczerner@redhat.com
> Subject: Re: [PATCH v2] generic: concurrent IO test with mixed IO types
> 
> On Mon, Jun 08, 2015 at 08:41:11PM +0800, Eryu Guan wrote:
> > Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> > same files.
> > 
> > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > ---
> > 
> > This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> > and xfs with 4.1-rc6 kernel.
> > 
> > ext4: WARNING: at fs/ext4/inode.c:1328
> > xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> > 
> > The ext4 issue should be fixed by Lukas's patch
> > ext4: fix reservation release on invalidatepage for delalloc fs
> > 
> > And it ever paniced kernel in mm code and hung xfs.
> > 
> > I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> > and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> > and xfs with reduced workload.
> > 
> > v2:
> > - use mktemp to create tmp fio job file
> ....
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +fio_config=`mktemp`
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> 
> By removing the definition of $tmp, you are now dumping all
> the temporary files the test harnes creates in /.

What temp files ? Yes we're sometimes using $tmp even though there
is no obvious definition and if we want to rely on the existence of
this variable we better define it as environment variable in 'check'
script. It may be enough to simply add

export tmp

to the 'check' script

But regardless of this bug it does not affect this test in any way
since it's not calling any of those functions and there are other
tests that does not define $tmp as well.

So I think that what Eryu did here is fine and we need to fix the
'check' script.

> 
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -f $fio_config
> > +}
> 
> And now not removing them when the test complests...

No, it only removes our $fio_config temp file.

Thanks!
-Lukas

> 
> Cheers,
> 
> Dave.
> 
--
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
Dave Chinner June 10, 2015, 11:11 a.m. UTC | #5
On Wed, Jun 10, 2015 at 11:01:57AM +0200, Lukáš Czerner wrote:
> On Wed, 10 Jun 2015, Dave Chinner wrote:
> 
> > Date: Wed, 10 Jun 2015 08:29:33 +1000
> > From: Dave Chinner <david@fromorbit.com>
> > To: Eryu Guan <eguan@redhat.com>
> > Cc: fstests@vger.kernel.org, lczerner@redhat.com
> > Subject: Re: [PATCH v2] generic: concurrent IO test with mixed IO types
> > 
> > On Mon, Jun 08, 2015 at 08:41:11PM +0800, Eryu Guan wrote:
> > > Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> > > same files.
> > > 
> > > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > > ---
> > > 
> > > This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> > > and xfs with 4.1-rc6 kernel.
> > > 
> > > ext4: WARNING: at fs/ext4/inode.c:1328
> > > xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> > > 
> > > The ext4 issue should be fixed by Lukas's patch
> > > ext4: fix reservation release on invalidatepage for delalloc fs
> > > 
> > > And it ever paniced kernel in mm code and hung xfs.
> > > 
> > > I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> > > and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> > > and xfs with reduced workload.
> > > 
> > > v2:
> > > - use mktemp to create tmp fio job file
> > ....
> > > +seq=`basename $0`
> > > +seqres=$RESULT_DIR/$seq
> > > +echo "QA output created by $seq"
> > > +
> > > +here=`pwd`
> > > +fio_config=`mktemp`
> > > +status=1	# failure is the default!
> > > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > 
> > By removing the definition of $tmp, you are now dumping all
> > the temporary files the test harnes creates in /.
> 
> What temp files ? Yes we're sometimes using $tmp even though there
> is no obvious definition and if we want to rely on the existence of
> this variable we better define it as environment variable in 'check'
> script.

About 80% of the files in the repository use $tmp in some way.
And it's used all over the place in common/*, too. e.g mkfs
and check functions for storing output for parsing....

> It may be enough to simply add
>
> export tmp
> 
> to the 'check' script

Then everything uses the same tmp file prefix (i.e. the pid of the
check script) rather than a test specific pid so we lose out on
debugging capability there, not to mention that "rm -f $tmp*" in a
test (like the majority of tests do in their cleanup() routine) will
remove all the tmp files that the test harness needs to do it's
stuff....

> But regardless of this bug it does not affect this test in any way
> since it's not calling any of those functions and there are other
> tests that does not define $tmp as well.

Which points out a couple more problems with the test to me. It uses
SCRATCH_MNT without calling _scratch_mkfs - which uses $tmp when
FSTYP=xfs - and it doesn't call _scratch_mount, either, so it's
running on the underlying filesystem rather than the filesystem it
is supposed to test.

And because it uses _require_scratch(), then ./check will call
_check_scratch_fs() to check the filesystem, and if FSTYP=xfs then
_check_xfs_filesystem is called and that uses $tmp....

Cheers,

Dave.
Dave Chinner June 10, 2015, 11:12 a.m. UTC | #6
On Wed, Jun 10, 2015 at 03:07:44PM +0800, Eryu Guan wrote:
> On Wed, Jun 10, 2015 at 08:29:33AM +1000, Dave Chinner wrote:
> > On Mon, Jun 08, 2015 at 08:41:11PM +0800, Eryu Guan wrote:
> > > Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> > > same files.
> > > 
> > > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > > ---
> > > 
> > > This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> > > and xfs with 4.1-rc6 kernel.
> > > 
> > > ext4: WARNING: at fs/ext4/inode.c:1328
> > > xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> > > 
> > > The ext4 issue should be fixed by Lukas's patch
> > > ext4: fix reservation release on invalidatepage for delalloc fs
> > > 
> > > And it ever paniced kernel in mm code and hung xfs.
> > > 
> > > I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> > > and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> > > and xfs with reduced workload.
> > > 
> > > v2:
> > > - use mktemp to create tmp fio job file
> > ....
> > > +seq=`basename $0`
> > > +seqres=$RESULT_DIR/$seq
> > > +echo "QA output created by $seq"
> > > +
> > > +here=`pwd`
> > > +fio_config=`mktemp`
> > > +status=1	# failure is the default!
> > > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > 
> > By removing the definition of $tmp, you are now dumping all
> > the temporary files the test harnes creates in /.
> 
> You're right, I see /fsck.log on my test host.
> 
> I checked 'check' and common/rc and chech has its "tmp=/tmp/$$"
> definition and I thought I didn't use any functions from common/rc in my
> test directly that depends on $tmp definition. I must have missed
> something.
> 
> Should I send a v3 and roll back to v1? or you can just take v1?

You'll need a v3 to fix the problem with using an uninitialised,
unmounted SCRATCH_DEV in the test...

Cheers,

Dave.
Eryu Guan June 10, 2015, 11:37 a.m. UTC | #7
On Wed, Jun 10, 2015 at 09:12:37PM +1000, Dave Chinner wrote:
> On Wed, Jun 10, 2015 at 03:07:44PM +0800, Eryu Guan wrote:
> > On Wed, Jun 10, 2015 at 08:29:33AM +1000, Dave Chinner wrote:
> > > On Mon, Jun 08, 2015 at 08:41:11PM +0800, Eryu Guan wrote:
> > > > Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> > > > same files.
> > > > 
> > > > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > > > ---
> > > > 
> > > > This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> > > > and xfs with 4.1-rc6 kernel.
> > > > 
> > > > ext4: WARNING: at fs/ext4/inode.c:1328
> > > > xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> > > > 
> > > > The ext4 issue should be fixed by Lukas's patch
> > > > ext4: fix reservation release on invalidatepage for delalloc fs
> > > > 
> > > > And it ever paniced kernel in mm code and hung xfs.
> > > > 
> > > > I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> > > > and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> > > > and xfs with reduced workload.
> > > > 
> > > > v2:
> > > > - use mktemp to create tmp fio job file
> > > ....
> > > > +seq=`basename $0`
> > > > +seqres=$RESULT_DIR/$seq
> > > > +echo "QA output created by $seq"
> > > > +
> > > > +here=`pwd`
> > > > +fio_config=`mktemp`
> > > > +status=1	# failure is the default!
> > > > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > > 
> > > By removing the definition of $tmp, you are now dumping all
> > > the temporary files the test harnes creates in /.
> > 
> > You're right, I see /fsck.log on my test host.
> > 
> > I checked 'check' and common/rc and chech has its "tmp=/tmp/$$"
> > definition and I thought I didn't use any functions from common/rc in my
> > test directly that depends on $tmp definition. I must have missed
> > something.
> > 
> > Should I send a v3 and roll back to v1? or you can just take v1?
> 
> You'll need a v3 to fix the problem with using an uninitialised,
> unmounted SCRATCH_DEV in the test...

How can I miss that.. Sorry and thanks!

Eryu
--
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
Lukas Czerner June 10, 2015, 12:22 p.m. UTC | #8
On Wed, 10 Jun 2015, Dave Chinner wrote:

> Date: Wed, 10 Jun 2015 21:11:53 +1000
> From: Dave Chinner <david@fromorbit.com>
> To: Lukáš Czerner <lczerner@redhat.com>
> Cc: Eryu Guan <eguan@redhat.com>, fstests@vger.kernel.org
> Subject: Re: [PATCH v2] generic: concurrent IO test with mixed IO types
> 
> On Wed, Jun 10, 2015 at 11:01:57AM +0200, Lukáš Czerner wrote:
> > On Wed, 10 Jun 2015, Dave Chinner wrote:
> > 
> > > Date: Wed, 10 Jun 2015 08:29:33 +1000
> > > From: Dave Chinner <david@fromorbit.com>
> > > To: Eryu Guan <eguan@redhat.com>
> > > Cc: fstests@vger.kernel.org, lczerner@redhat.com
> > > Subject: Re: [PATCH v2] generic: concurrent IO test with mixed IO types
> > > 
> > > On Mon, Jun 08, 2015 at 08:41:11PM +0800, Eryu Guan wrote:
> > > > Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> > > > same files.
> > > > 
> > > > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > > > ---
> > > > 
> > > > This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> > > > and xfs with 4.1-rc6 kernel.
> > > > 
> > > > ext4: WARNING: at fs/ext4/inode.c:1328
> > > > xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> > > > 
> > > > The ext4 issue should be fixed by Lukas's patch
> > > > ext4: fix reservation release on invalidatepage for delalloc fs
> > > > 
> > > > And it ever paniced kernel in mm code and hung xfs.
> > > > 
> > > > I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> > > > and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> > > > and xfs with reduced workload.
> > > > 
> > > > v2:
> > > > - use mktemp to create tmp fio job file
> > > ....
> > > > +seq=`basename $0`
> > > > +seqres=$RESULT_DIR/$seq
> > > > +echo "QA output created by $seq"
> > > > +
> > > > +here=`pwd`
> > > > +fio_config=`mktemp`
> > > > +status=1	# failure is the default!
> > > > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > > 
> > > By removing the definition of $tmp, you are now dumping all
> > > the temporary files the test harnes creates in /.
> > 
> > What temp files ? Yes we're sometimes using $tmp even though there
> > is no obvious definition and if we want to rely on the existence of
> > this variable we better define it as environment variable in 'check'
> > script.
> 
> About 80% of the files in the repository use $tmp in some way.
> And it's used all over the place in common/*, too. e.g mkfs
> and check functions for storing output for parsing....

Ah, come on. There are not that many functions using the $tmp and
some of them even removes the file immediately.

Removes immediatelly
common/attr	_acl_get_max
common/filter	_within_tolerance
common/rc	_check_generic_filesystem
common/rc	_check_xfs_filesystem
common/rc	_check_btrfs_filesystem

Does not remove
common/dump	_check_onl
		_create_dumpdir_stress_num
		_mk_fillconfig1
		_mk_fillconfig2
		_mk_fillconfig_ea
		_mk_fillconfig_xattr
		_mk_fillconfig_multi
		_append_dumpdir_fill
		_do_create_dump_symlinks
		_mk_symlink_config
		_do_dump_restore
		_ls_compare_sub
		_ls_nodate_compare_sub
		_create_dumpdir_stress_num
common/quota	_check_quota_usage
common/rc	_do

Most of the users are in the common/dump, however it's broken anyway
since on _cleanup() it does "rm -f $tmp.*" that'll remove all the
tmp file xfstests supposedly use.

> 
> > It may be enough to simply add
> >
> > export tmp
> > 
> > to the 'check' script
> 
> Then everything uses the same tmp file prefix (i.e. the pid of the
> check script) rather than a test specific pid so we lose out on
> debugging capability there, not to mention that "rm -f $tmp*" in a
> test (like the majority of tests do in their cleanup() routine) will
> remove all the tmp files that the test harness needs to do it's
> stuff....

What debugging ? First of all, all of the $tmp.* files are removed either
immediately or when the script ends and some of them are actually
dumped to the .full report anyway.

But regardless, the "rm -f $tmp*" called from the test _cleanup()
routine will _not_ remove tmp files that the test harness needs as
long as it defined it's own $tmp, so really using 'export' is the
right way for test that does not need their own tmp, or creates a
different name for they temp file, or directory.

Not even mentioning that there is not safety check to prevent us
from overwriting each other tmp files, or even temp files of
completely different unrelated process ( that's why we should use
mktemp).

> 
> > But regardless of this bug it does not affect this test in any way
> > since it's not calling any of those functions and there are other
> > tests that does not define $tmp as well.
> 
> Which points out a couple more problems with the test to me. It uses
> SCRATCH_MNT without calling _scratch_mkfs - which uses $tmp when
> FSTYP=xfs - and it doesn't call _scratch_mount, either, so it's
> running on the underlying filesystem rather than the filesystem it
> is supposed to test.

Right, that's a bug. Moreover if the test is the first test, or the
only test you run everything will be ok becuase 'check' script will
_scratch_mkfs and _scratch_mount for you for some reason ...

> 
> And because it uses _require_scratch(), then ./check will call
> _check_scratch_fs() to check the filesystem, and if FSTYP=xfs then
> _check_xfs_filesystem is called and that uses $tmp....

Not really. 'check' script calls _check_scratch_fs() and the $tmp is
defined there regardless of what the test itself is doing.

Regards,
-Lukas

> 
> Cheers,
> 
> Dave.
>
Dave Chinner June 10, 2015, 1:59 p.m. UTC | #9
On Wed, Jun 10, 2015 at 02:22:55PM +0200, Lukáš Czerner wrote:
> On Wed, 10 Jun 2015, Dave Chinner wrote:
> 
> > Date: Wed, 10 Jun 2015 21:11:53 +1000
> > From: Dave Chinner <david@fromorbit.com>
> > To: Lukáš Czerner <lczerner@redhat.com>
> > Cc: Eryu Guan <eguan@redhat.com>, fstests@vger.kernel.org
> > Subject: Re: [PATCH v2] generic: concurrent IO test with mixed IO types
> > 
> > On Wed, Jun 10, 2015 at 11:01:57AM +0200, Lukáš Czerner wrote:
> > > On Wed, 10 Jun 2015, Dave Chinner wrote:
> > > 
> > > > Date: Wed, 10 Jun 2015 08:29:33 +1000
> > > > From: Dave Chinner <david@fromorbit.com>
> > > > To: Eryu Guan <eguan@redhat.com>
> > > > Cc: fstests@vger.kernel.org, lczerner@redhat.com
> > > > Subject: Re: [PATCH v2] generic: concurrent IO test with mixed IO types
> > > > 
> > > > On Mon, Jun 08, 2015 at 08:41:11PM +0800, Eryu Guan wrote:
> > > > > Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> > > > > same files.
> > > > > 
> > > > > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > > > > ---
> > > > > 
> > > > > This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> > > > > and xfs with 4.1-rc6 kernel.
> > > > > 
> > > > > ext4: WARNING: at fs/ext4/inode.c:1328
> > > > > xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> > > > > 
> > > > > The ext4 issue should be fixed by Lukas's patch
> > > > > ext4: fix reservation release on invalidatepage for delalloc fs
> > > > > 
> > > > > And it ever paniced kernel in mm code and hung xfs.
> > > > > 
> > > > > I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> > > > > and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> > > > > and xfs with reduced workload.
> > > > > 
> > > > > v2:
> > > > > - use mktemp to create tmp fio job file
> > > > ....
> > > > > +seq=`basename $0`
> > > > > +seqres=$RESULT_DIR/$seq
> > > > > +echo "QA output created by $seq"
> > > > > +
> > > > > +here=`pwd`
> > > > > +fio_config=`mktemp`
> > > > > +status=1	# failure is the default!
> > > > > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > > > 
> > > > By removing the definition of $tmp, you are now dumping all
> > > > the temporary files the test harnes creates in /.
> > > 
> > > What temp files ? Yes we're sometimes using $tmp even though there
> > > is no obvious definition and if we want to rely on the existence of
> > > this variable we better define it as environment variable in 'check'
> > > script.
> > 
> > About 80% of the files in the repository use $tmp in some way.
> > And it's used all over the place in common/*, too. e.g mkfs
> > and check functions for storing output for parsing....
> 
> Ah, come on. There are not that many functions using the $tmp and
> some of them even removes the file immediately.

$ git grep -lw "^tmp=" |wc -l
484
$ git grep -lw "\$tmp" |wc -l
417

That's roughly 80% of files that use $tmp /in some way/. The tests
are all suppose dto define $tmp the same way, and they are all
expected to clean up after themselves, thereby making it possible to
safely use $tmp in linrary functions, whether they clean up after
tehmselves or not.

You're spending way more time and effort than is necessary on basic
infrastructure that has worked for 15 years and, quite frankly,
*doesn't need fixing because it's not broken*.

Cheers,

Dave.
Lukas Czerner June 10, 2015, 2:26 p.m. UTC | #10
On Wed, 10 Jun 2015, Dave Chinner wrote:

> Date: Wed, 10 Jun 2015 23:59:28 +1000
> From: Dave Chinner <david@fromorbit.com>
> To: Lukáš Czerner <lczerner@redhat.com>
> Cc: Eryu Guan <eguan@redhat.com>, fstests@vger.kernel.org
> Subject: Re: [PATCH v2] generic: concurrent IO test with mixed IO types
> 
> On Wed, Jun 10, 2015 at 02:22:55PM +0200, Lukáš Czerner wrote:
> > On Wed, 10 Jun 2015, Dave Chinner wrote:
> > 
> > > Date: Wed, 10 Jun 2015 21:11:53 +1000
> > > From: Dave Chinner <david@fromorbit.com>
> > > To: Lukáš Czerner <lczerner@redhat.com>
> > > Cc: Eryu Guan <eguan@redhat.com>, fstests@vger.kernel.org
> > > Subject: Re: [PATCH v2] generic: concurrent IO test with mixed IO types
> > > 
> > > On Wed, Jun 10, 2015 at 11:01:57AM +0200, Lukáš Czerner wrote:
> > > > On Wed, 10 Jun 2015, Dave Chinner wrote:
> > > > 
> > > > > Date: Wed, 10 Jun 2015 08:29:33 +1000
> > > > > From: Dave Chinner <david@fromorbit.com>
> > > > > To: Eryu Guan <eguan@redhat.com>
> > > > > Cc: fstests@vger.kernel.org, lczerner@redhat.com
> > > > > Subject: Re: [PATCH v2] generic: concurrent IO test with mixed IO types
> > > > > 
> > > > > On Mon, Jun 08, 2015 at 08:41:11PM +0800, Eryu Guan wrote:
> > > > > > Test concurrent buffered I/O, DIO, AIO, mmap I/O and splice I/O on the
> > > > > > same files.
> > > > > > 
> > > > > > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > > > > > ---
> > > > > > 
> > > > > > This fio job file has been proven to be potent, it triggers WARNINGs on ext4
> > > > > > and xfs with 4.1-rc6 kernel.
> > > > > > 
> > > > > > ext4: WARNING: at fs/ext4/inode.c:1328
> > > > > > xfs: WARNING: CPU: 7 PID: 3090 at fs/xfs/xfs_file.c:726 xfs_file_dio_aio_write+0x176/0x2a8 [xfs]()
> > > > > > 
> > > > > > The ext4 issue should be fixed by Lukas's patch
> > > > > > ext4: fix reservation release on invalidatepage for delalloc fs
> > > > > > 
> > > > > > And it ever paniced kernel in mm code and hung xfs.
> > > > > > 
> > > > > > I reduced the numjobs and iodepth to reduce the test time(~25s on my test host)
> > > > > > and scale them by $LOAD_FACTOR. And it still could trigger the warning on ext4
> > > > > > and xfs with reduced workload.
> > > > > > 
> > > > > > v2:
> > > > > > - use mktemp to create tmp fio job file
> > > > > ....
> > > > > > +seq=`basename $0`
> > > > > > +seqres=$RESULT_DIR/$seq
> > > > > > +echo "QA output created by $seq"
> > > > > > +
> > > > > > +here=`pwd`
> > > > > > +fio_config=`mktemp`
> > > > > > +status=1	# failure is the default!
> > > > > > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > > > > 
> > > > > By removing the definition of $tmp, you are now dumping all
> > > > > the temporary files the test harnes creates in /.
> > > > 
> > > > What temp files ? Yes we're sometimes using $tmp even though there
> > > > is no obvious definition and if we want to rely on the existence of
> > > > this variable we better define it as environment variable in 'check'
> > > > script.
> > > 
> > > About 80% of the files in the repository use $tmp in some way.
> > > And it's used all over the place in common/*, too. e.g mkfs
> > > and check functions for storing output for parsing....
> > 
> > Ah, come on. There are not that many functions using the $tmp and
> > some of them even removes the file immediately.
> 
> $ git grep -lw "^tmp=" |wc -l
> 484
> $ git grep -lw "\$tmp" |wc -l
> 417
> 
> That's roughly 80% of files that use $tmp /in some way/. The tests
> are all suppose dto define $tmp the same way, and they are all
> expected to clean up after themselves, thereby making it possible to
> safely use $tmp in linrary functions, whether they clean up after
> tehmselves or not.
> 
> You're spending way more time and effort than is necessary on basic
> infrastructure that has worked for 15 years and, quite frankly,
> *doesn't need fixing because it's not broken*.

Strongly disagree and patch like that just proves that it is
broken. But frankly you're right in that I am spending too much time
and effort arguing with you.

Regards,
-Lukas
diff mbox

Patch

diff --git a/tests/generic/090 b/tests/generic/090
new file mode 100755
index 0000000..3521cd4
--- /dev/null
+++ b/tests/generic/090
@@ -0,0 +1,120 @@ 
+#! /bin/bash
+# FS QA Test generic/090
+#
+# Concurrent mixed I/O (buffer I/O, aiodio, mmap, splice) on the same files
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Red Hat Inc. 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`
+fio_config=`mktemp`
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $fio_config
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+
+iodepth=$((16 * LOAD_FACTOR))
+iodepth_batch=$((8 * LOAD_FACTOR))
+numjobs=$((5 * LOAD_FACTOR))
+cat >$fio_config <<EOF
+[global]
+bs=8k
+iodepth=$iodepth
+iodepth_batch=$iodepth_batch
+randrepeat=1
+size=1m
+directory=$SCRATCH_MNT
+numjobs=$numjobs
+[job1]
+ioengine=sync
+bs=1k
+direct=1
+rw=randread
+filename=file1:file2
+[job2]
+ioengine=libaio
+rw=randwrite
+direct=1
+filename=file1:file2
+[job3]
+bs=1k
+ioengine=posixaio
+rw=randwrite
+direct=1
+filename=file1:file2
+[job4]
+ioengine=splice
+direct=1
+rw=randwrite
+filename=file1:file2
+[job5]
+bs=1k
+ioengine=sync
+rw=randread
+filename=file1:file2
+[job6]
+ioengine=posixaio
+rw=randwrite
+filename=file1:file2
+[job7]
+ioengine=splice
+rw=randwrite
+filename=file1:file2
+[job8]
+ioengine=mmap
+rw=randwrite
+bs=1k
+filename=file1:file2
+[job9]
+ioengine=mmap
+rw=randwrite
+direct=1
+filename=file1:file2
+EOF
+# with ioengine=mmap and direct=1, fio requires bs to be at least pagesize,
+# which is a fio built-in var.
+echo 'bs=$pagesize' >> $fio_config
+
+rm -f $seqres.full
+
+_require_fio $fio_config
+
+echo "Silence is golden"
+$FIO_PROG $fio_config >>$seqres.full 2>&1
+
+# all done, expect no hang no oops no fs corruption,
+# _check_dmesg and _check_filesystems will do the check work for us
+status=0
+exit
diff --git a/tests/generic/090.out b/tests/generic/090.out
new file mode 100644
index 0000000..2b5100d
--- /dev/null
+++ b/tests/generic/090.out
@@ -0,0 +1,2 @@ 
+QA output created by 090
+Silence is golden
diff --git a/tests/generic/group b/tests/generic/group
index 0c8964c..2e534a5 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -92,6 +92,7 @@ 
 087 perms auto quick
 088 perms auto quick
 089 metadata auto
+090 auto rw stress
 091 rw auto quick
 092 auto quick prealloc
 093 attr cap udf auto