]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
Hi,
authorJeff Moyer <jmoyer@redhat.com>
Wed, 3 Jun 2009 20:13:53 +0000 (15:13 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 3 Jun 2009 20:13:53 +0000 (15:13 -0500)
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>
src/aio-dio-regress/aio-dio-invalidate-failure.c

index a1a5df2f7fdebecf809189a6fca3ba97c6c13292..be01a3af1bbbf6b15cbf8e793bfad7db5b9dc4e1 100644 (file)
@@ -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