From: Jeff Moyer <jmoyer@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: fstests@vger.kernel.org, Matt Cross <matt.cross@gmail.com>
Subject: Re: [patch] add an aio test which closes the fd before destroying the ioctx
Date: Wed, 18 Jun 2014 14:17:01 -0400 [thread overview]
Message-ID: <x49k38eozfm.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20140610004911.GF4453@dastard> (Dave Chinner's message of "Tue, 10 Jun 2014 10:49:11 +1000")
Dave Chinner <david@fromorbit.com> writes:
> Ok, so the xfstest never runs the "waitevent == 2" case here, so
> perhaps all that workaround demonstration code can be removed?
sure
>> +char *
>> +round_up_to_page(unsigned char *ptr)
>> +{
>> + unsigned long buf = (unsigned long) ptr;
>> +
>> + if (buf % 4096) {
>> + buf += 4096 - buf%4096;
>> + }
>> +
>> + return (char *)buf;
>> +}
>
> Urk. Just use memalign() to allocate "page" aligned buffers and all
> this can go away.
>
> Also, can you change this code to 8 space tabs and generally clean
> it up to be the same as the kernel coding style? The mix of 2 space
> indents and tabs really screws up the indenting here...
Yeah. I was just trying to keep things close to original. I'll update
the coding style.
>> + CPU_ZERO(&cpuset);
>> + CPU_SET(mycpu, &cpuset);
>> + if (sched_setaffinity(mytid, sizeof(cpuset), &cpuset)) {
>> + printf("FAILED to set thread %d to run on cpu %ld\n", mytid, mycpu);
>> + }
>
> Any reason why process layout like this is necessary? Comments are
> nice, even in test code...
I honestly don't remember the specifics, other than it gave a better
probability for reproducing the failure. I can at least make a comment
stating that.
>> + io_prep_pread(iocb, fd, round_up_to_page(buffer), sizeof(buffer) - 4096, i * (sizeof(buffer) - 4096));
>
> Is that really just for page alignment, or is there some other magic
> going on here?
Just page alignment.
> Ok, so this runs in an endless loop....
>
>> + printf ("All threads spawned\n");
>> +
>> + gettimeofday(&start, NULL);
>> +
>> + while (delta.tv_sec < 300) {
>> + sleep(1);
>> + gettimeofday(&now, NULL);
>> + timersub(&now, &start, &delta);
>> + dprintf("%lu loops completed in %ld seconds\n", total_loop_count, delta.tv_sec);
>> + }
>> +
>> + return 0;
>
> And it just exits when the timer expires, with still active AIOs in
> flight. Which means that the tst harness may well finsih up and try
> to unmount the filesystem while IOs are still in flight. That will
> cause spurious test failures because the scratch filesystem can't be
> unmounted....
No, the exit path will block on outstanding I/Os. By the time the
process exits, all I/O should be complete.
>> +#-----------------------------------------------------------------------
>> +# Copyright (c) 2014 Jeff Moyer. All Rights Reserved.
>
> Sent from a Red Hat email address. Can you please clarify who owns
> the copyright?
The script is mine, the code is Matt's. There are copyright headers in
both, and they attribute the copyright to the proper individual. What
isn't clear about that?
>> +AIO_TEST=src/aio-dio-regress/aio-last-ref-in-irq-context
>> +if [ ! -x $AIO_TEST ]; then
>> + _notrun "$AIO_TEST not built"
>> +fi
>
> _require_aiodio aio-last-ref-in-irq-context
>
> That also sets up the AIO_TEST variable.
ok
>> +
>> +_run_323() {
>> + local testtemp=$TEST_DIR/aio-testfile
>
> testfile?
Are you suggesting that I rename aio-tesfile to testfile? Or rename
testtempt to testfile? Something else?
>> + rm -f $testtemp
>> + dd if=/dev/zero of=$testtemp bs=1M count=10
>
> Use xfs_io rather than dd:
>
> $XFS_IO_PROG -ftc "pwrite 0 10m" $testfile | _filter_xfs_io
>
> And the "-ft" options mean you don't need to rm the $testfile
> because it'll get truncated to empty first or created if it doesn't
> exist.
ok
>> + $AIO_TEST 0 100 $testtemp
>> + $AIO_TEST 1 100 $testtemp
>> + status=$?
>> + rm -f $testtemp
>
> no need to remove the test file - the $TEST_DIR is supposed to age
> with the tests that are run, so leaving scraps around is a good
> idea...
>
>> + return $status
>> +}
>> +
>> +_run_323
>
> Like I said, no need for a function for such a simple test...
I'm no bash guru. I created a function in order to avoid creating a
global testtemp variable. If that doesn't matter, I'm happen to flatten
things out.
>> +exit $status
>> diff --git a/tests/generic/323.out b/tests/generic/323.out
>> new file mode 100644
>> index 0000000..8405271
>> --- /dev/null
>> +++ b/tests/generic/323.out
>> @@ -0,0 +1,11 @@
>> +QA output created by 323
>> +10+0 records in
>> +10+0 records out
>> +wait_for_events: 0
>> +num_threads: 100
>> +filename: '/mnt/test/aio-testfile'
>
> This output needs to pass through _filter_testdir - so the $AIO_TEST
> executions need to be:
>
> $AIO_TEST 0 100 $testfile | _filter_test_dir
OK
Thanks for the review, Dave!
-Jeff
next prev parent reply other threads:[~2014-06-18 18:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <x4961k97o9o.fsf@segfault.boston.devel.redhat.com>
2014-06-10 0:49 ` [patch] add an aio test which closes the fd before destroying the ioctx Dave Chinner
2014-06-18 18:17 ` Jeff Moyer [this message]
2014-06-18 23:56 ` Dave Chinner
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=x49k38eozfm.fsf@segfault.boston.devel.redhat.com \
--to=jmoyer@redhat.com \
--cc=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
--cc=matt.cross@gmail.com \
/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