public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: gaowanlong@cn.fujitsu.com
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as writers
Date: Tue, 20 Aug 2013 03:06:11 -0400 (EDT)	[thread overview]
Message-ID: <386542620.1062949.1376982371162.JavaMail.root@redhat.com> (raw)
In-Reply-To: <5213105C.5010905@cn.fujitsu.com>


----- Original Message -----
> From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp-list@lists.sourceforge.net
> Sent: Tuesday, 20 August, 2013 8:44:44 AM
> Subject: Re: [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as writers
> 
> On 08/20/2013 02:34 PM, Jan Stancek wrote:
> > 
> > 
> > ----- Original Message -----
> >> From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com>
> >> To: "Jan Stancek" <jstancek@redhat.com>
> >> Cc: ltp-list@lists.sourceforge.net
> >> Sent: Tuesday, 20 August, 2013 5:13:09 AM
> >> Subject: Re: [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as
> >> writers
> >>
> >> On 08/19/2013 09:38 PM, Jan Stancek wrote:
> >>> Starting with 3.10 dio_sparse sporadically fails, because
> >>> read() in read_sparse returns garbage and dio_sparse testcase
> >>> fails with:
> >>>   dio_sparse    0  TINFO  :  Dirtying free blocks
> >>>   dio_sparse    0  TINFO  :  Starting I/O tests
> >>>   non zero buffer at buf[0] => 0xffffffaa,ffffffaa,ffffffaa,ffffffaa
> >>>   non-zero read at offset 0
> >>>   dio_sparse    0  TINFO  :  Killing childrens(s)
> >>>   dio_sparse    1  TFAIL  :  1 children(s) exited abnormally
> >>
> >> Why did I always meet the EINVAL error?
> >> Like:
> >> dio_sparse    1  TBROK  :  open(): errno=EINVAL(22): Invalid argument
> >>
> >> Caused by the file system's O_DIRECT support?
> > 
> > It's possible, I know you'll get EINVAL if your tmp directory is tmpfs.
> > Can you try to run it with "env TMPDIR=/root" and see if
> > that makes difference?
> 
> I tried with "-d /root/test" and the case PASSED, but without your patch.
> 
> tag=ADSP044 stime=1376980874
> cmdline="dio_sparse  -a 2k -w 2k -s 2k -n 2"
> contacts=""
> analysis=exit
> <<<test_output>>>
> incrementing stop
> dio_sparse    0  TINFO  :  Dirtying free blocks
> dio_sparse    0  TINFO  :  Starting I/O tests
> dio_sparse    0  TINFO  :  Killing childrens(s)
> dio_sparse    1  TPASS  :  Test passed
> 
> 
> /root/test is ext4 file system, and the kernel is 3.10.4-300.fc19.x86_64.
> 
> Still can't see the FAIL like you said?

The FAIL is sporadic, I also get PASS most of the time.

The most reliable way to trigger it so far seems to be running it in loop
on KVM guest with 2 CPUs (/tmp is ext4), where it usually triggers in couple minutes.

virt-install --name x86_64_kvm --mac 52:56:00:00:00:01 --ram=2048 --vcpus=2 --file-size=20 --hvm --nonsparse --debug --extra-args "console=tty0 console=ttyS0,115200" --accelerate --os-variant=virtio26 --ver6 --network bridge:br0  --serial file,path=/root/x86_64_kvm_console.log --file /var/lib/libvirt/images/x86_64_kvm.img

Regards,
Jan

> 
> Thanks,
> Wanlong Gao
> 
> > 
> > Regards,
> > Jan
> > 
> >>
> >> Thanks,
> >> Wanlong Gao
> >>
> >>>
> >>> Issue is that we have parent opening file as O_DIRECT and
> >>> children trying to read from it without O_DIRECT, which is
> >>> discouraged in man pages.
> >>>
> >>> open(2) says:
> >>> "Applications should avoid mixing O_DIRECT and normal I/O to the same
> >>> file, and especially to overlapping byte regions in the same file."
> >>>
> >>> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> >>> ---
> >>>  testcases/kernel/io/ltp-aiodio/aiodio_sparse.c |    2 +-
> >>>  testcases/kernel/io/ltp-aiodio/common_sparse.h |    4 ++--
> >>>  testcases/kernel/io/ltp-aiodio/dio_sparse.c    |    2 +-
> >>>  3 files changed, 4 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
> >>> b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
> >>> index 944e12b..705bbc5 100644
> >>> --- a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
> >>> +++ b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c
> >>> @@ -279,7 +279,7 @@ int main(int argc, char **argv)
> >>>  	for (i = 0; i < num_children; i++) {
> >>>  		switch (pid[i] = fork()) {
> >>>  		case 0:
> >>> -			read_sparse(filename, filesize);
> >>> +			read_sparse(filename, filesize, O_DIRECT);
> >>>  			break;
> >>>  		case -1:
> >>>  			while (i-- > 0)
> >>> diff --git a/testcases/kernel/io/ltp-aiodio/common_sparse.h
> >>> b/testcases/kernel/io/ltp-aiodio/common_sparse.h
> >>> index f7f4ef4..6a294cb 100644
> >>> --- a/testcases/kernel/io/ltp-aiodio/common_sparse.h
> >>> +++ b/testcases/kernel/io/ltp-aiodio/common_sparse.h
> >>> @@ -104,7 +104,7 @@ char *check_zero(char *buf, int size)
> >>>   * either there is a hole in the file,
> >>>   * or zeroes were actually written by parent.
> >>>   */
> >>> -static void read_sparse(char *filename, int filesize)
> >>> +static void read_sparse(char *filename, int filesize, int mode)
> >>>  {
> >>>  	int fd;
> >>>  	int  i, j, r;
> >>> @@ -114,7 +114,7 @@ static void read_sparse(char *filename, int filesize)
> >>>  	 * Wait for the file to appear.
> >>>  	 */
> >>>  	for (i = 0; i < 10000; i++) {
> >>> -		fd = open(filename, O_RDONLY);
> >>> +		fd = open(filename, O_RDONLY | mode);
> >>>  
> >>>  		if (fd != -1)
> >>>  			break;
> >>> diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> >>> b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> >>> index 7ad5f80..eaaea14 100644
> >>> --- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> >>> +++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
> >>> @@ -153,7 +153,7 @@ int main(int argc, char **argv)
> >>>  	for (i = 0; i < num_children; i++) {
> >>>  		switch (pid[i] = fork()) {
> >>>  		case 0:
> >>> -			read_sparse(filename, filesize);
> >>> +			read_sparse(filename, filesize, O_DIRECT);
> >>>  			break;
> >>>  		case -1:
> >>>  			while (i-- > 0)
> >>>
> >>
> >>
> > 
> 
> 

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2013-08-20  7:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 13:38 [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as writers Jan Stancek
2013-08-20  3:13 ` Wanlong Gao
2013-08-20  6:34   ` Jan Stancek
2013-08-20  6:44     ` Wanlong Gao
2013-08-20  7:06       ` Jan Stancek [this message]
2013-08-21 10:24 ` chrubis
2013-08-21 13:41   ` chrubis
     [not found]     ` <92780376.1937886.1377095931551.JavaMail.root@redhat.com>
2013-08-21 15:06       ` chrubis
     [not found]         ` <1843973614.1971535.1377606877922.JavaMail.root@redhat.com>
2013-08-27 12:58           ` chrubis

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=386542620.1062949.1376982371162.JavaMail.root@redhat.com \
    --to=jstancek@redhat.com \
    --cc=gaowanlong@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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