public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix tst-aio7.
@ 2003-03-06 15:11 Martin Schwidefsky
  2003-03-06 19:17 ` Roland McGrath
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Schwidefsky @ 2003-03-06 15:11 UTC (permalink / raw)
  To: libc-hacker

Hi,
the tst-aio7 testcase sometimes fails for s390-64. After some
debugging I found out why. The aio_suspend test starts
a read on aio buffer cb1. This read never completes.
The aio buffer is still enqueued when the block that
contains the aiocb structure is left. The exit processing
will cancel the i/o and the exit status will be written to the
stack which is reused for a stack frame in the meantime.
This sometimes segfaults on s390-64, sometimes it works.
The fix is simple: cancel the i/o before leaving the block
that defines cb1.

blue skies,
  Martin.

2003-03-06  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* rt/tst-aio7.c (do_test): Cancel i/o on cb1.

diff -urN libc/rt/tst-aio7.c libc-aiofix/rt/tst-aio7.c
--- libc/rt/tst-aio7.c	Mon Sep 30 09:19:21 2002
+++ libc-aiofix/rt/tst-aio7.c	Thu Mar  6 10:38:00 2003
@@ -180,6 +180,14 @@
 	puts ("aio_suspend([done,blocked],2,3) suspended thread");
 	++result;
       }
+
+    /* Cancel i/o on cb1. */
+    r = aio_cancel (piped[0], &cb1);
+    if (r != AIO_CANCELED)
+      {
+	puts ("aio_cancel did not return AIO_CANCELED");
+	++result;
+      }
   }
 
   return result;

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

* Re: [PATCH] Fix tst-aio7.
  2003-03-06 15:11 [PATCH] Fix tst-aio7 Martin Schwidefsky
@ 2003-03-06 19:17 ` Roland McGrath
  2003-03-06 19:32   ` Ulrich Drepper
  0 siblings, 1 reply; 6+ messages in thread
From: Roland McGrath @ 2003-03-06 19:17 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: libc-hacker

Thanks a lot!  I've put that fix in.  I think we've seen occasional
tst-aio7 failures on multiple platforms, and this certainly explains it.


Thanks,
Roland

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

* Re: [PATCH] Fix tst-aio7.
  2003-03-06 19:17 ` Roland McGrath
@ 2003-03-06 19:32   ` Ulrich Drepper
  2003-03-06 19:37     ` Roland McGrath
  0 siblings, 1 reply; 6+ messages in thread
From: Ulrich Drepper @ 2003-03-06 19:32 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Martin Schwidefsky, libc-hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roland McGrath wrote:
> Thanks a lot!  I've put that fix in.  I think we've seen occasional
> tst-aio7 failures on multiple platforms, and this certainly explains it.

No, this does not sound right.  This works around the symptoms.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+Z6Ju2ijCOnn/RHQRAodFAKDJrUDw3nUbGt5iPgE4qn5CAdhnXACgyoj5
tMw4oeZ6pnnSWmFpUGqqo1Q=
=WMP/
-----END PGP SIGNATURE-----

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

* Re: [PATCH] Fix tst-aio7.
  2003-03-06 19:32   ` Ulrich Drepper
@ 2003-03-06 19:37     ` Roland McGrath
  2003-03-06 19:56       ` Ulrich Drepper
  0 siblings, 1 reply; 6+ messages in thread
From: Roland McGrath @ 2003-03-06 19:37 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Martin Schwidefsky, libc-hacker

> No, this does not sound right.  This works around the symptoms.

How so?  The test looks clearly wrong to me.  aio_suspend will return when
the CB0 request is done, and the CB1 request is still outstanding.  Unless
we synchronize with that request, CB1 is still in the aio data structures
when it is no longer live on the stack.

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

* Re: [PATCH] Fix tst-aio7.
  2003-03-06 19:37     ` Roland McGrath
@ 2003-03-06 19:56       ` Ulrich Drepper
  2003-03-06 20:21         ` Roland McGrath
  0 siblings, 1 reply; 6+ messages in thread
From: Ulrich Drepper @ 2003-03-06 19:56 UTC (permalink / raw)
  To: Roland McGrath; +Cc: libc-hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roland McGrath wrote:

> How so?  The test looks clearly wrong to me.  aio_suspend will return when
> the CB0 request is done, and the CB1 request is still outstanding.  Unless
> we synchronize with that request, CB1 is still in the aio data structures
> when it is no longer live on the stack.

Then these variables have to have global scope.

The test in question was also testing that the AIO handling at exit time
is leak-free.  There is not explicit test but one easily sees system
resources being depleated.  This is important once we have a
kernel-supported AIO implementation.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+Z6gj2ijCOnn/RHQRAiM/AKCMnrRh33tGLQtD4OX/25RZUY/YPACgof8+
1u4fOGGrnW8cD7ftE0vbQ14=
=FNCu
-----END PGP SIGNATURE-----

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

* Re: [PATCH] Fix tst-aio7.
  2003-03-06 19:56       ` Ulrich Drepper
@ 2003-03-06 20:21         ` Roland McGrath
  0 siblings, 0 replies; 6+ messages in thread
From: Roland McGrath @ 2003-03-06 20:21 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

> Then these variables have to have global scope.
> 
> The test in question was also testing that the AIO handling at exit time
> is leak-free.  There is not explicit test but one easily sees system
> resources being depleated.  This is important once we have a
> kernel-supported AIO implementation.

Ok.  I've reverted the aio_cancel change and instead given CB1 permanent
extent so that it's valid.  I put in a comment mentioning this rationale.

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

end of thread, other threads:[~2003-03-06 20:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-06 15:11 [PATCH] Fix tst-aio7 Martin Schwidefsky
2003-03-06 19:17 ` Roland McGrath
2003-03-06 19:32   ` Ulrich Drepper
2003-03-06 19:37     ` Roland McGrath
2003-03-06 19:56       ` Ulrich Drepper
2003-03-06 20:21         ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).