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 <jmoyer@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
Jeff Moyer
2009-06-03 15:13:53 -05:00
committed by Eric Sandeen
parent 6b26794772
commit be64a1a99b
@@ -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