public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net, lidan <li.dan@cn.fujitsu.com>
Subject: Re: [LTP] [PATCH] aio_fsync:4-2: wait until the io is in no INPROGRESS
Date: Wed, 26 Oct 2011 16:15:25 +0200	[thread overview]
Message-ID: <20111026141525.GE9338@saboteur.suse.cz> (raw)
In-Reply-To: <1319609427-28098-1-git-send-email-gaowanlong@cn.fujitsu.com>

Hi!
> If the aio is in INPROGRESS, the aio_return is undefined, and
> may cause Segment Faul.
> So, wait for it.
> 
> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> Signed-off-by: lidan <li.dan@cn.fujitsu.com>
> ---
>  .../conformance/interfaces/aio_fsync/4-2.c         |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/4-2.c
> index bf76109..2be8d4b 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/4-2.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/4-2.c
> @@ -68,6 +68,7 @@ int main()
>  		exit(PTS_FAIL);
>  	}
>  
> +	while(aio_error(&aiocb_fsync) == EINPROGRESS);
>  	errno = 0;
>  	aio_return(&aiocb_fsync);
>  	if (errno != 0)
> @@ -78,4 +79,4 @@ int main()
>  	close(fd);
>  	printf ("Test PASSED\n");
>  	return PTS_PASS;
> -}
> \ No newline at end of file
> +}

Yes that is one of the problems with that testcase, however I would like
to see some usleep() in the while body, because otherwise this is
basically bussy loop which would unnecesarilly eat cputime.

The other problem is that most of the aio functions are not modifying
the errno, which is common misconception (the aio_read and aio_write may
return -1 and set the errno if the error happend while the aio operation
was being initalized). So correct test would check the return value from
aio_error() and then check that return value from aio_return() match the
buffer size. Mind that you could call them it exactly once after the
operation is finished.

And seeing the difference between 4-1.c and 4-2.c these two should be
merged into one testcase.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

       reply	other threads:[~2011-10-26 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1319609427-28098-1-git-send-email-gaowanlong@cn.fujitsu.com>
2011-10-26 14:15 ` Cyril Hrubis [this message]
     [not found]   ` <1319680368-6816-1-git-send-email-gaowanlong@cn.fujitsu.com>
2011-10-27 11:58     ` [LTP] [PATCH v2] aio_fsync: merged 4-1 and 4-2 Cyril Hrubis
     [not found]       ` <4EAA0C7C.3020503@cn.fujitsu.com>
2011-11-03 13:39         ` Cyril Hrubis

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=20111026141525.GE9338@saboteur.suse.cz \
    --to=chrubis@suse.cz \
    --cc=gaowanlong@cn.fujitsu.com \
    --cc=li.dan@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