Running generic/032 can sporadically fail like this:
generic/032 11s ... - output mismatch (see /home/fdmanana/git/hub/xfstests/results//generic/032.out.bad)
--- tests/generic/032.out 2023-03-02 21:47:53.
884609618 +0000
+++ /home/fdmanana/git/hub/xfstests/results//generic/032.out.bad 2025-05-28 10:39:34.
549499493 +0100
@@ -1,5 +1,6 @@
QA output created by 032
100 iterations
+/home/fdmanana/git/hub/xfstests/tests/generic/032: line 90: wait: pid
3708239 is not a child of this shell
000000 cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd >................<
*
100000
...
(Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/032.out /home/fdmanana/git/h
This is because we are attempting to wait for a process that is not a
child process of the test process and it's instead a child of a process
spawned by the test.
To make sure that after we kill the process running _syncloop() there
isn't any xfs_io process still running syncfs, add instead a trap to
to _syncloop() that waits for xfs_io to finish before the process running
that function exits.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
_syncloop()
{
+ # Wait for any running xfs_io command running syncfs before we exit so
+ # that unmount will not fail due to the mount being pinned by xfs_io.
+ trap "wait; exit" SIGTERM
+
while [ true ]; do
_scratch_sync
done
kill $syncpid
wait
-# The xfs_io instance started by _scratch_sync could be stuck in D state when
-# the subshell running _syncloop & is killed. That xfs_io process pins the
-# mount so we must kill it and wait for it to die before cycling the mount.
-dead_syncfs_pid=$(_pgrep xfs_io)
-if [ -n "$dead_syncfs_pid" ]; then
- _pkill xfs_io
- wait $dead_syncfs_pid
-fi
-
# clear page cache and dump the file
_scratch_cycle_mount
_hexdump $SCRATCH_MNT/file