From: Filipe Manana Date: Wed, 28 May 2025 11:42:20 +0000 (+0100) Subject: generic/032: fix failure due to attempt to wait for non-child process X-Git-Tag: v2025.06.22~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ec9a19e726974bf726b75f15ab01b6ecb483d2aa;p=xfstests-dev.git generic/032: fix failure due to attempt to wait for non-child process 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 Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- diff --git a/tests/generic/032 b/tests/generic/032 index 48d594fe..b04b84de 100755 --- a/tests/generic/032 +++ b/tests/generic/032 @@ -28,6 +28,10 @@ _cleanup() _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 @@ -81,15 +85,6 @@ echo $iters iterations 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