Apparently the subshell kill doesn't always take, and then the test runs
for hours and hours because nothing stops it. Instead, use a sentinel
file to detect when fstrim_loop should stop execing background fstrims.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
wait $fpid
fi
while [ $start -lt $fsize ] ; do
+ test -s $tmp.fstrim_loop || break
$FSTRIM_PROG -m ${minlen}k -o ${start}k -l ${step}k $SCRATCH_MNT &
fpid=$!
wait $fpid
start=$(( $start + $step ))
done
+ test -s $tmp.fstrim_loop || break
done
+ rm -f $tmp.fstrim_loop
}
function check_sums() {
echo -n "Running the test: "
pids=""
+echo run > $tmp.fstrim_loop
fstrim_loop &
fstrim_pid=$!
p=1
echo "done."
wait $pids
-kill $fstrim_pid
-wait $fstrim_pid
+truncate -s 0 $tmp.fstrim_loop
+while test -e $tmp.fstrim_loop; do
+ sleep 1
+done
status=0