mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
generic/446: make sure all background processes are dead before umount
The $dread_pid refers to the while-true-do loop, wait for $dread_pid doesn't mean the xfs_io direct read process is already dead, sometimes xfs_io process is still running and blocking _scratch_unmount. Fix it by making the direct read does a fixed number of loop and break out the second mmap-fpunch loop if the first loop exits. At this point we're sure that there's no unfinished background process blocking the umount. Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
+3
-3
@@ -61,20 +61,20 @@ filesz=$((65536 * 2))
|
|||||||
$XFS_IO_PROG -f -c "truncate $((filesz * 2))" $SCRATCH_MNT/file >> $seqres.full
|
$XFS_IO_PROG -f -c "truncate $((filesz * 2))" $SCRATCH_MNT/file >> $seqres.full
|
||||||
|
|
||||||
# run a background dio read to a hole in a loop
|
# run a background dio read to a hole in a loop
|
||||||
while true; do
|
for i in `seq 0 999`; do
|
||||||
$XFS_IO_PROG -d -c "pread 0 $filesz" $SCRATCH_MNT/file > /dev/null 2>&1
|
$XFS_IO_PROG -d -c "pread 0 $filesz" $SCRATCH_MNT/file > /dev/null 2>&1
|
||||||
done &
|
done &
|
||||||
|
|
||||||
dread_pid=$!
|
dread_pid=$!
|
||||||
|
|
||||||
# run mapped write to the same hole as dio read
|
# run mapped write to the same hole as dio read
|
||||||
for i in `seq 0 999`; do
|
# loop until background dio read exits
|
||||||
|
while kill -s 0 $dread_pid >/dev/null 2>&1; do
|
||||||
$XFS_IO_PROG -c "mmap 0 $filesz" -c "mwrite 0 $filesz" $SCRATCH_MNT/file \
|
$XFS_IO_PROG -c "mmap 0 $filesz" -c "mwrite 0 $filesz" $SCRATCH_MNT/file \
|
||||||
> /dev/null
|
> /dev/null
|
||||||
$XFS_IO_PROG -c "fpunch 0 $filesz" $SCRATCH_MNT/file > /dev/null
|
$XFS_IO_PROG -c "fpunch 0 $filesz" $SCRATCH_MNT/file > /dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
kill -9 $dread_pid > /dev/null 2>&1
|
|
||||||
wait $dread_pid > /dev/null 2>&1
|
wait $dread_pid > /dev/null 2>&1
|
||||||
|
|
||||||
echo "Silence is golden"
|
echo "Silence is golden"
|
||||||
|
|||||||
Reference in New Issue
Block a user