public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] V2: patch for aio_suspend/3-1
@ 2012-08-06  8:19 Kang Kai
  2012-08-06  8:19 ` [LTP] [PATCH] aio_suspend/3-1: wait all aio_write complete Kang Kai
  0 siblings, 1 reply; 6+ messages in thread
From: Kang Kai @ 2012-08-06  8:19 UTC (permalink / raw)
  To: gaowanlong; +Cc: ltp-list, Zhenfeng.Zhao

Hi Wanlong,

This V2 remove aio_cancel operation and wait aio_write to complete as your comments.

Regards,
Kai


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] aio_suspend/3-1: wait all aio_write complete
  2012-08-06  8:19 [LTP] V2: patch for aio_suspend/3-1 Kang Kai
@ 2012-08-06  8:19 ` Kang Kai
  2012-08-06  8:32   ` Wanlong Gao
  0 siblings, 1 reply; 6+ messages in thread
From: Kang Kai @ 2012-08-06  8:19 UTC (permalink / raw)
  To: gaowanlong; +Cc: ltp-list, Zhenfeng.Zhao

After aio_suspend, wait all aio_write operations to complete.

If don't do that, it fails with "Segmentation fault" on routerstation(mips)
board randomly about in 1000 continuous test. The reason may be some
aio_writes don't complete before close the file, that cause some resouse
don't be released and finally cause segment fault.

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 .../conformance/interfaces/aio_suspend/3-1.c       |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
index 15120e1..e8e9705 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
@@ -46,6 +46,7 @@ int main()
 	struct aiocb aiocb[NAIOCB];
 	const struct aiocb *list[NENT];
 	int i;
+	int ret;
 
 	if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
 		return PTS_UNSUPPORTED;
@@ -87,6 +88,17 @@ int main()
 		exit(PTS_FAIL);
 	}
 
+	for (i = 0; i < NAIOCB; ++i) {
+		do {
+			usleep(10000);
+			ret = aio_error(&aiocb[i]);
+		} while (ret == EINPROGRESS);
+		if (aio_return(&aiocb[i]) == -1) {
+			printf(TNAME " Error at aio_return(): %s\n", strerror(errno));
+			exit(PTS_FAIL);
+		}
+	}
+
 	close(fd);
 	printf("Test PASSED\n");
 	return PTS_PASS;
-- 
1.7.5.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] aio_suspend/3-1: wait all aio_write complete
  2012-08-06  8:19 ` [LTP] [PATCH] aio_suspend/3-1: wait all aio_write complete Kang Kai
@ 2012-08-06  8:32   ` Wanlong Gao
  2012-08-06  9:30     ` Kang Kai
  0 siblings, 1 reply; 6+ messages in thread
From: Wanlong Gao @ 2012-08-06  8:32 UTC (permalink / raw)
  To: Kang Kai; +Cc: ltp-list, Zhenfeng.Zhao

On 08/06/2012 04:19 PM, Kang Kai wrote:
> After aio_suspend, wait all aio_write operations to complete.
> 
> If don't do that, it fails with "Segmentation fault" on routerstation(mips)
> board randomly about in 1000 continuous test. The reason may be some
> aio_writes don't complete before close the file, that cause some resouse
> don't be released and finally cause segment fault.
> 
> Signed-off-by: Kang Kai <kai.kang@windriver.com>
> ---
>  .../conformance/interfaces/aio_suspend/3-1.c       |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
> index 15120e1..e8e9705 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
> @@ -46,6 +46,7 @@ int main()
>  	struct aiocb aiocb[NAIOCB];
>  	const struct aiocb *list[NENT];
>  	int i;
> +	int ret;
>  
>  	if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
>  		return PTS_UNSUPPORTED;
> @@ -87,6 +88,17 @@ int main()
>  		exit(PTS_FAIL);
>  	}
>  
> +	for (i = 0; i < NAIOCB; ++i) {
> +		do {
> +			usleep(10000);
> +			ret = aio_error(&aiocb[i]);
> +		} while (ret == EINPROGRESS);
> +		if (aio_return(&aiocb[i]) == -1) {

Why do you check the return value here? and did you test this patch on your mips machine?

Thanks,
Wanlong Gao

> +			printf(TNAME " Error at aio_return(): %s\n", strerror(errno));
> +			exit(PTS_FAIL);
> +		}
> +	}
> +
>  	close(fd);
>  	printf("Test PASSED\n");
>  	return PTS_PASS;
> 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] aio_suspend/3-1: wait all aio_write complete
  2012-08-06  8:32   ` Wanlong Gao
@ 2012-08-06  9:30     ` Kang Kai
  2012-08-06  9:37       ` Wanlong Gao
  0 siblings, 1 reply; 6+ messages in thread
From: Kang Kai @ 2012-08-06  9:30 UTC (permalink / raw)
  To: gaowanlong; +Cc: ltp-list, Zhenfeng.Zhao

On 2012年08月06日 16:32, Wanlong Gao wrote:
> On 08/06/2012 04:19 PM, Kang Kai wrote:
>> After aio_suspend, wait all aio_write operations to complete.
>>
>> If don't do that, it fails with "Segmentation fault" on routerstation(mips)
>> board randomly about in 1000 continuous test. The reason may be some
>> aio_writes don't complete before close the file, that cause some resouse
>> don't be released and finally cause segment fault.
>>
>> Signed-off-by: Kang Kai<kai.kang@windriver.com>
>> ---
>>   .../conformance/interfaces/aio_suspend/3-1.c       |   12 ++++++++++++
>>   1 files changed, 12 insertions(+), 0 deletions(-)
>>
>> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
>> index 15120e1..e8e9705 100644
>> --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
>> @@ -46,6 +46,7 @@ int main()
>>   	struct aiocb aiocb[NAIOCB];
>>   	const struct aiocb *list[NENT];
>>   	int i;
>> +	int ret;
>>
>>   	if (sysconf(_SC_ASYNCHRONOUS_IO)<  200112L)
>>   		return PTS_UNSUPPORTED;
>> @@ -87,6 +88,17 @@ int main()
>>   		exit(PTS_FAIL);
>>   	}
>>
>> +	for (i = 0; i<  NAIOCB; ++i) {
>> +		do {
>> +			usleep(10000);
>> +			ret = aio_error(&aiocb[i]);
>> +		} while (ret == EINPROGRESS);
>> +		if (aio_return(&aiocb[i]) == -1) {

Hi Wanlong,

> Why do you check the return value here? and did you test this patch on your mips machine?
I test it on mips for 4x1000 times and x86_64, and the results are fine.
With no other operation, when aio_write complete, it should succeed. So 
I use aio_return to check the return values.

Regards,
Kai

>
> Thanks,
> Wanlong Gao
>
>> +			printf(TNAME " Error at aio_return(): %s\n", strerror(errno));
>> +			exit(PTS_FAIL);
>> +		}
>> +	}
>> +
>>   	close(fd);
>>   	printf("Test PASSED\n");
>>   	return PTS_PASS;
>>
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] aio_suspend/3-1: wait all aio_write complete
  2012-08-06  9:30     ` Kang Kai
@ 2012-08-06  9:37       ` Wanlong Gao
  2012-08-06 10:04         ` Kang Kai
  0 siblings, 1 reply; 6+ messages in thread
From: Wanlong Gao @ 2012-08-06  9:37 UTC (permalink / raw)
  To: Kang Kai; +Cc: ltp-list, Zhenfeng.Zhao

On 08/06/2012 05:30 PM, Kang Kai wrote:
> On 2012年08月06日 16:32, Wanlong Gao wrote:
>> On 08/06/2012 04:19 PM, Kang Kai wrote:
>>> After aio_suspend, wait all aio_write operations to complete.
>>>
>>> If don't do that, it fails with "Segmentation fault" on routerstation(mips)
>>> board randomly about in 1000 continuous test. The reason may be some
>>> aio_writes don't complete before close the file, that cause some resouse
>>> don't be released and finally cause segment fault.
>>>
>>> Signed-off-by: Kang Kai<kai.kang@windriver.com>
>>> ---
>>>   .../conformance/interfaces/aio_suspend/3-1.c       |   12 ++++++++++++
>>>   1 files changed, 12 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
>>> index 15120e1..e8e9705 100644
>>> --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
>>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
>>> @@ -46,6 +46,7 @@ int main()
>>>       struct aiocb aiocb[NAIOCB];
>>>       const struct aiocb *list[NENT];
>>>       int i;
>>> +    int ret;
>>>
>>>       if (sysconf(_SC_ASYNCHRONOUS_IO)<  200112L)
>>>           return PTS_UNSUPPORTED;
>>> @@ -87,6 +88,17 @@ int main()
>>>           exit(PTS_FAIL);
>>>       }
>>>
>>> +    for (i = 0; i<  NAIOCB; ++i) {
>>> +        do {
>>> +            usleep(10000);
>>> +            ret = aio_error(&aiocb[i]);
>>> +        } while (ret == EINPROGRESS);
>>> +        if (aio_return(&aiocb[i]) == -1) {
> 
> Hi Wanlong,
> 
>> Why do you check the return value here? and did you test this patch on your mips machine?
> I test it on mips for 4x1000 times and x86_64, and the results are fine.
> With no other operation, when aio_write complete, it should succeed. So I use aio_return to check the return values.
> 

OK. Pushed. Thank you.

Wanlong Gao

> Regards,
> Kai
> 
>>
>> Thanks,
>> Wanlong Gao
>>
>>> +            printf(TNAME " Error at aio_return(): %s\n", strerror(errno));
>>> +            exit(PTS_FAIL);
>>> +        }
>>> +    }
>>> +
>>>       close(fd);
>>>       printf("Test PASSED\n");
>>>       return PTS_PASS;
>>>
>>
> 
> 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] aio_suspend/3-1: wait all aio_write complete
  2012-08-06  9:37       ` Wanlong Gao
@ 2012-08-06 10:04         ` Kang Kai
  0 siblings, 0 replies; 6+ messages in thread
From: Kang Kai @ 2012-08-06 10:04 UTC (permalink / raw)
  To: gaowanlong; +Cc: ltp-list, Zhenfeng.Zhao

On 2012年08月06日 17:37, Wanlong Gao wrote:
> On 08/06/2012 05:30 PM, Kang Kai wrote:
>> On 2012年08月06日 16:32, Wanlong Gao wrote:
>>> On 08/06/2012 04:19 PM, Kang Kai wrote:
>>>> After aio_suspend, wait all aio_write operations to complete.
>>>>
>>>> If don't do that, it fails with "Segmentation fault" on routerstation(mips)
>>>> board randomly about in 1000 continuous test. The reason may be some
>>>> aio_writes don't complete before close the file, that cause some resouse
>>>> don't be released and finally cause segment fault.
>>>>
>>>> Signed-off-by: Kang Kai<kai.kang@windriver.com>
>>>> ---
>>>>    .../conformance/interfaces/aio_suspend/3-1.c       |   12 ++++++++++++
>>>>    1 files changed, 12 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
>>>> index 15120e1..e8e9705 100644
>>>> --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
>>>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
>>>> @@ -46,6 +46,7 @@ int main()
>>>>        struct aiocb aiocb[NAIOCB];
>>>>        const struct aiocb *list[NENT];
>>>>        int i;
>>>> +    int ret;
>>>>
>>>>        if (sysconf(_SC_ASYNCHRONOUS_IO)<   200112L)
>>>>            return PTS_UNSUPPORTED;
>>>> @@ -87,6 +88,17 @@ int main()
>>>>            exit(PTS_FAIL);
>>>>        }
>>>>
>>>> +    for (i = 0; i<   NAIOCB; ++i) {
>>>> +        do {
>>>> +            usleep(10000);
>>>> +            ret = aio_error(&aiocb[i]);
>>>> +        } while (ret == EINPROGRESS);
>>>> +        if (aio_return(&aiocb[i]) == -1) {
>> Hi Wanlong,
>>
>>> Why do you check the return value here? and did you test this patch on your mips machine?
>> I test it on mips for 4x1000 times and x86_64, and the results are fine.
>> With no other operation, when aio_write complete, it should succeed. So I use aio_return to check the return values.
>>
> OK. Pushed. Thank you.
Thanks a lot.

Kai

> Wanlong Gao
>
>> Regards,
>> Kai
>>
>>> Thanks,
>>> Wanlong Gao
>>>
>>>> +            printf(TNAME " Error at aio_return(): %s\n", strerror(errno));
>>>> +            exit(PTS_FAIL);
>>>> +        }
>>>> +    }
>>>> +
>>>>        close(fd);
>>>>        printf("Test PASSED\n");
>>>>        return PTS_PASS;
>>>>
>>
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-06 10:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-06  8:19 [LTP] V2: patch for aio_suspend/3-1 Kang Kai
2012-08-06  8:19 ` [LTP] [PATCH] aio_suspend/3-1: wait all aio_write complete Kang Kai
2012-08-06  8:32   ` Wanlong Gao
2012-08-06  9:30     ` Kang Kai
2012-08-06  9:37       ` Wanlong Gao
2012-08-06 10:04         ` Kang Kai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox