aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-05-09 10:54:48 +1000
committerDave Chinner <david@fromorbit.com>2016-05-09 10:54:48 +1000
commitd0ec5f5af9479137526b73b8b4f48ef028444ffc (patch)
tree160bed3dedea2ea60d252a077232af31b818ce00
parent507d31596cb2410ed6f6a7a6ccb4aefc92645be1 (diff)
downloadxfstests-dev-d0ec5f5af9479137526b73b8b4f48ef028444ffc.tar.gz
generic/038: Avoid EBUSY errors on umount
Although the test waits for running subshells after sending SIGTERM signal to them, it does not wait for subprocesses of those subshells properly. Thus we can hit EBUSY errors when umount is called. Make subshells wait for executed subprocesses when receiving SIGTERM to avoid the problem. Signed-off-by: Jan Kara <jack@suse.cz> Acked-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rwxr-xr-xtests/generic/03815
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/generic/038 b/tests/generic/038
index 59aed67a..025e1b0f 100755
--- a/tests/generic/038
+++ b/tests/generic/038
@@ -77,6 +77,10 @@ rm -f $seqres.full
# 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" \
@@ -90,6 +94,10 @@ fallocate_loop()
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
@@ -115,7 +123,9 @@ create_files()
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
@@ -152,9 +162,6 @@ kill ${fallocate_pids[@]}
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