* [LTP] [PATCH] fix race at exit by checking if write completed
@ 2013-02-05 7:33 Yan Lei
2013-02-05 10:52 ` Jan Stancek
2013-02-05 12:02 ` chrubis
0 siblings, 2 replies; 3+ messages in thread
From: Yan Lei @ 2013-02-05 7:33 UTC (permalink / raw)
To: ltp-list; +Cc: Yan Lei
The same issue as:
commit 352358cd9f69f6e8296cc201b14bae938287796e
Author: Jan Stancek <jstancek@redhat.com>
Date: Mon, 28 Jan 2013 11:36:48 +0100
aio_fsync/2-1.c: fix race at exit, check if write completed
This patch waits for aio_fsync to complete and after that
checks that previously queued write is also completed.
Signed-off-by: Yan Lei <yanl.fnst@cn.fujitsu.com>
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c
index f30f472..6f0098d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c
@@ -27,7 +27,7 @@ int main()
{
char tmpfname[256];
char buf[BUF_SIZE];
- int fd;
+ int fd, ret;
struct aiocb aiocb_write;
struct aiocb aiocb_fsync;
@@ -62,10 +62,28 @@ int main()
printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno));
exit(PTS_FAIL);
}
+ /* wait for aio_fsync */
+ do {
+ usleep(10000);
+ ret = aio_error(&aiocb_fsync);
+ } while (ret == EINPROGRESS);
- close(fd);
+ ret = aio_return(&aiocb_fsync);
+ if (ret) {
+ printf(TNAME " Error at aio_return(): %d (%s)\n",
+ ret, strerror(errno));
+ close(fd);
+ return PTS_FAIL;
+ }
- /* we didn't check if the operation is really performed */
+ /* 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;
+ }
- return PTS_UNTESTED;
+ close(fd);
+ return PTS_PASS;
}
--
1.8.1.rc3.11.g86c3e6e
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [LTP] [PATCH] fix race at exit by checking if write completed
2013-02-05 7:33 [LTP] [PATCH] fix race at exit by checking if write completed Yan Lei
@ 2013-02-05 10:52 ` Jan Stancek
2013-02-05 12:02 ` chrubis
1 sibling, 0 replies; 3+ messages in thread
From: Jan Stancek @ 2013-02-05 10:52 UTC (permalink / raw)
To: Yan Lei; +Cc: ltp-list
----- Original Message -----
> From: "Yan Lei" <yanl.fnst@cn.fujitsu.com>
> To: ltp-list@lists.sourceforge.net
> Cc: "Yan Lei" <yanl.fnst@cn.fujitsu.com>
> Sent: Tuesday, 5 February, 2013 8:33:05 AM
> Subject: [LTP] [PATCH] fix race at exit by checking if write completed
>
> The same issue as:
> commit 352358cd9f69f6e8296cc201b14bae938287796e
> Author: Jan Stancek <jstancek@redhat.com>
> Date: Mon, 28 Jan 2013 11:36:48 +0100
> aio_fsync/2-1.c: fix race at exit, check if write completed
> This patch waits for aio_fsync to complete and after that
> checks that previously queued write is also completed.
>
> Signed-off-by: Yan Lei <yanl.fnst@cn.fujitsu.com>
I wonder why I missed that. Definitely same issue as in 2-1.
Acked-by: Jan Stancek <jstancek@redhat.com>
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] fix race at exit by checking if write completed
2013-02-05 7:33 [LTP] [PATCH] fix race at exit by checking if write completed Yan Lei
2013-02-05 10:52 ` Jan Stancek
@ 2013-02-05 12:02 ` chrubis
1 sibling, 0 replies; 3+ messages in thread
From: chrubis @ 2013-02-05 12:02 UTC (permalink / raw)
To: Yan Lei; +Cc: ltp-list
Hi!
> The same issue as:
> commit 352358cd9f69f6e8296cc201b14bae938287796e
> Author: Jan Stancek <jstancek@redhat.com>
> Date: Mon, 28 Jan 2013 11:36:48 +0100
> aio_fsync/2-1.c: fix race at exit, check if write completed
> This patch waits for aio_fsync to complete and after that
> checks that previously queued write is also completed.
>
> Signed-off-by: Yan Lei <yanl.fnst@cn.fujitsu.com>
Commited, thanks.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-05 12:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05 7:33 [LTP] [PATCH] fix race at exit by checking if write completed Yan Lei
2013-02-05 10:52 ` Jan Stancek
2013-02-05 12:02 ` chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox