@@ -40,6 +40,16 @@ _pkill()
fi
}
+# Find only the test processes started by this test
+_pgrep()
+{
+ if [ "$FSTESTS_ISOL" = "setsid" ]; then
+ pgrep --session 0 "$@"
+ else
+ pgrep "$@"
+ fi
+}
+
# Common execution handling for fsstress invocation.
#
# We need per-test fsstress binaries because of the way fsstress forks and
@@ -81,6 +81,15 @@ 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