From be64a1a99b559a07e47377c700897606146602c4 Mon Sep 17 00:00:00 2001 From: Jeff Moyer Date: Wed, 3 Jun 2009 15:13:53 -0500 Subject: [PATCH] Hi, So, the xfs test suite does a mount, followed by running the test, then an unmount after the test exits. aio-dio-invalidate-failure spawns two children, and will kill them off before it exits. The problem is that it doesn't wait for them to exit before returning, so the xfs test harness ends up failing the umount as the mount point is still busy. The fix is to simply wait for each of the children exits before returning from the parent. (Eric Sandeen: add one more waitpid to error case) Signed-off-by: Jeff Moyer Reviewed-by: Eric Sandeen --- src/aio-dio-regress/aio-dio-invalidate-failure.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/aio-dio-regress/aio-dio-invalidate-failure.c b/src/aio-dio-regress/aio-dio-invalidate-failure.c index a1a5df2f..be01a3af 100644 --- a/src/aio-dio-regress/aio-dio-invalidate-failure.c +++ b/src/aio-dio-regress/aio-dio-invalidate-failure.c @@ -141,6 +141,7 @@ int main(int argc, char **argv) dio_pid = fork(); if (dio_pid < 0) { kill(buffered_pid, SIGKILL); + waitpid(buffered_pid, NULL, 0); fail("fork failed: %d\n", errno); } @@ -157,14 +158,21 @@ int main(int argc, char **argv) /* if we timed out then we're done */ kill(buffered_pid, SIGKILL); kill(dio_pid, SIGKILL); + + waitpid(buffered_pid, NULL, 0); + waitpid(dio_pid, NULL, 0); + printf("ran for %d seconds without error, passing\n", SECONDS); exit(0); } - if (pid == dio_pid) + if (pid == dio_pid) { kill(buffered_pid, SIGKILL); - else + waitpid(buffered_pid, NULL, 0); + } else { kill(dio_pid, SIGKILL); + waitpid(dio_pid, NULL, 0); + } /* * pass on the child's pass/fail return code or fail if the child -- 2.39.5