Skip to contentSkip to conversation

aio_cancel/7-1: fix fail occasionally due to aio_error() returns EBADF

PATCH Cyril Hrubis 1 participant 3 messages Sep 2, 2011 – Nov 16, 2011 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi!

Quoted 19 lines
---
 .../conformance/interfaces/aio_cancel/7-1.c        |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c +0 -2
index c37f184..756b0af 100644
@@ -112,8 +112,6 @@ int main()
 		return PTS_FAIL;
 	}
 
-	close(fd);
-
 	do {
 		in_progress = 0;
 		for (i = 0; i < BUF_NB; i++)

testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c int main() · line 164

Quoted 6 lines
testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c +2 -0
@@ -161,5 +159,7 @@ int main()
 		}
 	} while (in_progress);
 
+	close(fd);
+
 	return PTS_UNRESOLVED;

Yes, closing the fd before aio operation is completed is wrong. However the fix is not 100% correct either. The file would be closed only when you get out of the do while() loop, which has several returns there.

So we may rather:

* change the code to close the fd correctly

or

* don't close the fd at all as we don't care about the file anyway

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#2 lore raw

Hi!

Quoted 3 lines

So we may rather:

* change the code to close the fd correctly

Eg. in all codepaths

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi!
Commited, thanks.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list