# fstrim loop below.
fallocate_loop()
{
+ # Wait for running subcommand before exitting so that
+ # mountpoint is not busy when we try to unmount it
+ trap "wait; exit" SIGTERM
+
local name=$1
while true; do
$XFS_IO_PROG -f -c "falloc -k 0 1G" \
trim_loop()
{
+ # Wait for running subcommand before exitting so that
+ # mountpoint is not busy when we try to unmount it
+ trap "wait; exit" SIGTERM
+
while true; do
$FSTRIM_PROG $SCRATCH_MNT
done
for ((n = 0; n < 4; n++)); do
mkdir $SCRATCH_MNT/$n
(
- for ((i = 1; i <= $nr_files; i++)); do
+ trap "wait; exit" SIGTERM
+
+ for ((i = 1; i <= $nr_files; i++)); do
$XFS_IO_PROG -f -c "pwrite -S 0xaa 0 3900" \
$SCRATCH_MNT/$n/"${prefix}_$i" &> /dev/null
if [ $? -ne 0 ]; then
kill ${trim_pids[@]}
wait
-# Sleep a bit, otherwise umount fails often with EBUSY (TODO: investigate why).
-sleep 3
-
# The fstests framework will now check for fs consistency with fsck.
# The trimming was racy and caused some btree nodes to get full of zeroes on
# disk, which obviously caused fs metadata corruption. The race often lead