From: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] ltp-aiodio/dio_sparse: Fix usleep in read_sparse()
Date: Tue, 14 Feb 2017 11:20:50 +0800 [thread overview]
Message-ID: <58A27792.2090306@cn.fujitsu.com> (raw)
In-Reply-To: <20170209093451.GB12673@rei.lan>
Hi!
On 02/09/2017 05:35 PM, Cyril Hrubis wrote:
> Hi!
>> usleep(100000) sometimes leads to child process being too late
>> to do the read before being killed by parent process, tune it
>> to usleep(100) to make sure we do the real test in time.
>>
>> Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
>> ---
>> testcases/kernel/io/ltp-aiodio/common_sparse.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/testcases/kernel/io/ltp-aiodio/common_sparse.h b/testcases/kernel/io/ltp-aiodio/common_sparse.h
>> index f7f4ef4..7297319 100644
>> --- a/testcases/kernel/io/ltp-aiodio/common_sparse.h
>> +++ b/testcases/kernel/io/ltp-aiodio/common_sparse.h
>> @@ -113,7 +113,7 @@ static void read_sparse(char *filename, int filesize)
>> /*
>> * Wait for the file to appear.
>> */
>> - for (i = 0; i < 10000; i++) {
>> + for (i = 0; i < 10000000; i++) {
>> fd = open(filename, O_RDONLY);
>>
>> if (fd != -1)
>> @@ -123,7 +123,7 @@ static void read_sparse(char *filename, int filesize)
>> fprintf(stderr, "Child %i waits for '%s' to appear\n",
>> getpid(), filename);
>>
>> - usleep(100000);
>> + usleep(100);
>> }
>
> Looking at the code again, I see no reason why we can't open and
> truncate the file before we start the read_sparse() children, then we
> could drop this loop and just pass file descriptor to this function and
> to the dio_sparse() and aiodio_sparse() as well. Or did I miss
> something?
Yes, you are right, it is a thoroghly solution to this issue,
I will rewrite this according to your suggestion, thanks.
Best Regards,
Guangwen Feng
next prev parent reply other threads:[~2017-02-14 3:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 9:32 [LTP] [PATCH 1/2] ltp-aiodio/dio_sparse: Fix write in dio_sparse() Guangwen Feng
2017-01-19 9:32 ` [LTP] [PATCH 2/2] ltp-aiodio/dio_sparse: Fix usleep in read_sparse() Guangwen Feng
2017-01-24 13:43 ` Cyril Hrubis
2017-01-25 4:02 ` Guangwen Feng
2017-02-09 7:23 ` [LTP] [PATCH v2] " Guangwen Feng
2017-02-09 9:35 ` Cyril Hrubis
2017-02-14 3:20 ` Guangwen Feng [this message]
2017-03-21 8:08 ` [LTP] [PATCH] ltp-aiodio: Create the file before fork Guangwen Feng
2017-03-22 15:33 ` Cyril Hrubis
2017-01-24 13:40 ` [LTP] [PATCH 1/2] ltp-aiodio/dio_sparse: Fix write in dio_sparse() Cyril Hrubis
2017-01-25 4:33 ` Guangwen Feng
2017-02-09 8:56 ` Guangwen Feng
2017-02-09 9:31 ` Cyril Hrubis
2017-02-14 8:53 ` Guangwen Feng
2017-02-16 13:12 ` 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=58A27792.2090306@cn.fujitsu.com \
--to=fenggw-fnst@cn.fujitsu.com \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.