* [LTP] [PATCH v2] aio_fsync/2-1.c: fix race at exit, check if write completed
@ 2013-01-28 10:36 Jan Stancek
2013-01-30 1:46 ` Wanlong Gao
0 siblings, 1 reply; 2+ messages in thread
From: Jan Stancek @ 2013-01-28 10:36 UTC (permalink / raw)
To: ltp-list
This is same issue as:
commit 4558bfae923a715ac78b5b3d3ecdfa16f9424808
Author: Jan Stancek <jstancek@redhat.com>
Date: Wed Dec 5 12:49:47 2012 +0100
aio_read/7-1.c: fix race at exit
This patch waits for aio_fsync to complete and after that
checks that previously queued write is also completed.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../conformance/interfaces/aio_fsync/2-1.c | 26 ++++++++++++++++---
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/2-1.c
index a534513..09da565 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/2-1.c
@@ -27,7 +27,7 @@ int main(void)
{
char tmpfname[256];
char buf[BUF_SIZE];
- int fd;
+ int fd, ret;
struct aiocb aiocb_write;
struct aiocb aiocb_fsync;
@@ -63,9 +63,27 @@ int main(void)
exit(PTS_FAIL);
}
- close(fd);
+ /* wait for aio_fsync */
+ do {
+ usleep(10000);
+ ret = aio_error(&aiocb_fsync);
+ } while (ret == EINPROGRESS);
- /* we didn't check if the operation is really performed */
+ ret = aio_return(&aiocb_fsync);
+ if (ret) {
+ printf(TNAME " Error at aio_return(): %d (%s)\n",
+ ret, strerror(errno));
+ close(fd);
+ return PTS_FAIL;
+ }
- return PTS_UNTESTED;
+ /* check that aio_write is completed at this point */
+ ret = aio_error(&aiocb_write);
+ if (ret == EINPROGRESS) {
+ printf(TNAME " aiocb_write still in progress\n");
+ close(fd);
+ return PTS_FAIL;
+ }
+ close(fd);
+ return PTS_PASS;
}
--
1.7.1
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH v2] aio_fsync/2-1.c: fix race at exit, check if write completed
2013-01-28 10:36 [LTP] [PATCH v2] aio_fsync/2-1.c: fix race at exit, check if write completed Jan Stancek
@ 2013-01-30 1:46 ` Wanlong Gao
0 siblings, 0 replies; 2+ messages in thread
From: Wanlong Gao @ 2013-01-30 1:46 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
On 01/28/2013 06:36 PM, Jan Stancek wrote:
> This is same issue as:
> commit 4558bfae923a715ac78b5b3d3ecdfa16f9424808
> Author: Jan Stancek <jstancek@redhat.com>
> Date: Wed Dec 5 12:49:47 2012 +0100
> aio_read/7-1.c: fix race at exit
>
> This patch waits for aio_fsync to complete and after that
> checks that previously queued write is also completed.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Applied, thank you.
Wanlong Gao
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-30 1:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28 10:36 [LTP] [PATCH v2] aio_fsync/2-1.c: fix race at exit, check if write completed Jan Stancek
2013-01-30 1:46 ` Wanlong Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox