1
0
mirror of https://git.proxmox.com/git/mirror_zfs.git synced 2025-08-06 15:07:39 +03:00

ZTS: fix spurious failures in mv_files

The test could fail because of a race condition between the files being
generated in the background and attempting to move the files. Wait for
all file generation to complete before trying to move the files around.

Also, clean up the waiting: the 'wait' command without arguments waits
for all child pids.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chris Dunlop <chris@onthe.net.au>
Closes  
Closes  
Closes 
This commit is contained in:
chrisrd 2018-03-03 04:57:29 +11:00 committed by Brian Behlendorf
parent e086e717c3
commit d0f6fbaff3

View File

@ -108,16 +108,6 @@ function init_setup
} }
function wait_pid
{
for pid in $1
do
ps -e | grep $pid >/dev/null 2>&1
(( $? == 0 )) && wait $pid
done
}
# #
# Generate given number files in a # Generate given number files in a
# directory of zfs file system # directory of zfs file system
@ -141,18 +131,17 @@ function generate_files
cp /etc/passwd $1/file_$count \ cp /etc/passwd $1/file_$count \
> /dev/null 2>&1 & > /dev/null 2>&1 &
PIDS="$PIDS $!" (( proc_num = proc_num + 1 ))
proc_num=`echo $PIDS | wc -w`
if (( proc_num >= GANGPIDS )); then if (( proc_num >= GANGPIDS )); then
wait_pid "$PIDS" wait
proc_num=0 proc_num=0
PIDS=""
fi fi
(( count = count + 1 )) (( count = count + 1 ))
done done
wait
} }
# #