generic: don't put loop control files on the scratch mount

If we're doing write/overwrite/snapshot/resource exhaustion tests on
the scratch device, use the test directory to hold the loop
termination signal files.  This way we don't run infinitely because
we can't create the flag due to ENOSPC.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Darrick J. Wong
2016-05-26 20:28:05 -07:00
committed by Eryu Guan
parent b5e26de924
commit 478f75b0d0
10 changed files with 64 additions and 40 deletions
+5 -3
View File
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file
wait wait
} }
@@ -51,6 +51,8 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
mkdir $testdir mkdir $testdir
loops=512 loops=512
@@ -64,7 +66,7 @@ _pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file2 >> $seqres.full
_scratch_cycle_mount _scratch_cycle_mount
overwrite() { overwrite() {
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
seq $nr_loops -1 0 | while read i; do seq $nr_loops -1 0 | while read i; do
_pwrite_byte 0x61 $((i * blksz)) $blksz $testdir/file2 >> $seqres.full _pwrite_byte 0x61 $((i * blksz)) $blksz $testdir/file2 >> $seqres.full
done done
@@ -81,7 +83,7 @@ for i in `seq 1 2`; do
done done
done done
echo "Finished dedupeing" echo "Finished dedupeing"
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done
+5 -3
View File
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file
wait wait
} }
@@ -51,6 +51,8 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
mkdir $testdir mkdir $testdir
loops=512 loops=512
@@ -64,7 +66,7 @@ _pwrite_byte 0x61 0 $((loops * blksz)) $testdir/file2 >> $seqres.full
_scratch_cycle_mount _scratch_cycle_mount
overwrite() { overwrite() {
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
seq $nr_loops -1 0 | while read i; do seq $nr_loops -1 0 | while read i; do
_pwrite_byte 0x61 $((i * blksz)) $blksz $testdir/file1 >> $seqres.full _pwrite_byte 0x61 $((i * blksz)) $blksz $testdir/file1 >> $seqres.full
done done
@@ -81,7 +83,7 @@ for i in `seq 1 2`; do
done done
done done
echo "Finished dedupeing" echo "Finished dedupeing"
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done
+5 -3
View File
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file
wait wait
} }
@@ -53,6 +53,8 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
mkdir $testdir mkdir $testdir
loops=512 loops=512
@@ -71,7 +73,7 @@ fbytes() {
} }
reader() { reader() {
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
_read_range $testdir/file3 0 $((loops * blksz)) | fbytes _read_range $testdir/file3 0 $((loops * blksz)) | fbytes
done done
} }
@@ -91,7 +93,7 @@ for i in `seq 1 2`; do
done done
done done
echo "Finished reflinking" echo "Finished reflinking"
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done
+5 -3
View File
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file
wait wait
} }
@@ -54,6 +54,8 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
mkdir $testdir mkdir $testdir
loops=512 loops=512
@@ -72,7 +74,7 @@ fbytes() {
} }
reader() { reader() {
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
_read_range $testdir/file3 0 $((loops * blksz)) -d | fbytes _read_range $testdir/file3 0 $((loops * blksz)) -d | fbytes
done done
} }
@@ -92,7 +94,7 @@ for i in `seq 1 2`; do
done done
done done
echo "Finished reflinking" echo "Finished reflinking"
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done
+5 -3
View File
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file
wait wait
} }
@@ -54,6 +54,8 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
mkdir $testdir mkdir $testdir
loops=1024 loops=1024
@@ -68,7 +70,7 @@ _scratch_cycle_mount
# Snapshot creator... # Snapshot creator...
snappy() { snappy() {
n=0 n=0
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)" out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
res=$? res=$?
echo "$out" | grep -q "No space left" && break echo "$out" | grep -q "No space left" && break
@@ -83,7 +85,7 @@ snappy &
seq $nr_loops -1 0 | while read i; do seq $nr_loops -1 0 | while read i; do
_pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file1 >> $seqres.full _pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file1 >> $seqres.full
done done
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done
+5 -3
View File
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file
wait wait
} }
@@ -53,6 +53,8 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
mkdir $testdir mkdir $testdir
loops=1024 loops=1024
@@ -67,7 +69,7 @@ _scratch_cycle_mount
# Snapshot creator... # Snapshot creator...
snappy() { snappy() {
n=0 n=0
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)" out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
res=$? res=$?
echo "$out" | grep -q "No space left" && break echo "$out" | grep -q "No space left" && break
@@ -82,7 +84,7 @@ snappy &
seq $nr_loops -1 0 | while read i; do seq $nr_loops -1 0 | while read i; do
_pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file1 >> $seqres.full _pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file1 >> $seqres.full
done done
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done
+5 -3
View File
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file
wait wait
} }
@@ -52,6 +52,8 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
mkdir $testdir mkdir $testdir
loops=1024 loops=1024
@@ -66,7 +68,7 @@ _scratch_cycle_mount
# Direct I/O overwriter... # Direct I/O overwriter...
overwrite() { overwrite() {
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
seq $nr_loops -1 0 | while read i; do seq $nr_loops -1 0 | while read i; do
_pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file2 >> $seqres.full _pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file2 >> $seqres.full
done done
@@ -82,7 +84,7 @@ seq 1 10 | while read j; do
[ $? -ne 0 ] && exit [ $? -ne 0 ] && exit
done done
done done
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done
+5 -3
View File
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file
wait wait
} }
@@ -53,6 +53,8 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
mkdir $testdir mkdir $testdir
loops=1024 loops=1024
@@ -67,7 +69,7 @@ _scratch_cycle_mount
# Direct I/O overwriter... # Direct I/O overwriter...
overwrite() { overwrite() {
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
seq $nr_loops -1 0 | while read i; do seq $nr_loops -1 0 | while read i; do
_pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file2 >> $seqres.full _pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file2 >> $seqres.full
done done
@@ -83,7 +85,7 @@ seq 1 10 | while read j; do
[ $? -ne 0 ] && exit [ $? -ne 0 ] && exit
done done
done done
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done
+12 -8
View File
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file $abort_file
wait wait
} }
@@ -54,6 +54,10 @@ _scratch_mkfs_sized $((400 * 1048576)) > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
abort_file=/tmp/abort
rm -rf $abort_file
mkdir $testdir mkdir $testdir
loops=1024 loops=1024
@@ -68,7 +72,7 @@ _scratch_cycle_mount
# Snapshot creator... # Snapshot creator...
snappy() { snappy() {
n=0 n=0
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)" out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
res=$? res=$?
echo $out | grep -q "No space left" && break echo $out | grep -q "No space left" && break
@@ -76,7 +80,7 @@ snappy() {
test $res -ne 0 && break test $res -ne 0 && break
n=$((n + 1)) n=$((n + 1))
done done
touch $testdir/abort touch $abort_file
} }
echo "Snapshot a file undergoing directio rewrite" echo "Snapshot a file undergoing directio rewrite"
@@ -85,13 +89,13 @@ seq 1 1000 | while read j; do
seq $nr_loops -1 0 | while read i; do seq $nr_loops -1 0 | while read i; do
out="$(_pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file1 2>&1)" out="$(_pwrite_byte 0x63 $((i * blksz)) $blksz -d $testdir/file1 2>&1)"
echo $out >> $seqres.full echo $out >> $seqres.full
echo $out | grep -q "No space left" && touch $testdir/abort echo $out | grep -q "No space left" && touch $abort_file
echo $out | grep -qi "error" && touch $testdir/abort echo $out | grep -qi "error" && touch $abort_file
test -e $testdir/abort && break test -e $abort_file && break
done done
test -e $testdir/abort && break test -e $abort_file && break
done done
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done
+12 -8
View File
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 7 15
_cleanup() _cleanup()
{ {
cd / cd /
rm -rf $tmp.* rm -rf $tmp.* $finished_file $abort_file
wait wait
} }
@@ -53,6 +53,10 @@ _scratch_mkfs_sized $((400 * 1048576)) > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1
testdir=$SCRATCH_MNT/test-$seq testdir=$SCRATCH_MNT/test-$seq
finished_file=/tmp/finished
rm -rf $finished_file
abort_file=/tmp/abort
rm -rf $abort_file
mkdir $testdir mkdir $testdir
loops=1024 loops=1024
@@ -67,7 +71,7 @@ _scratch_cycle_mount
# Snapshot creator... # Snapshot creator...
snappy() { snappy() {
n=0 n=0
while [ ! -e $testdir/finished ]; do while [ ! -e $finished_file ]; do
out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)" out="$(_cp_reflink $testdir/file1 $testdir/snap_$n 2>&1)"
res=$? res=$?
echo $out | grep -q "No space left" && break echo $out | grep -q "No space left" && break
@@ -75,7 +79,7 @@ snappy() {
test $res -ne 0 && break test $res -ne 0 && break
n=$((n + 1)) n=$((n + 1))
done done
touch $testdir/abort touch $abort_file
} }
echo "Snapshot a file undergoing buffered rewrite" echo "Snapshot a file undergoing buffered rewrite"
@@ -84,13 +88,13 @@ seq 1 1000 | while read j; do
seq $nr_loops -1 0 | while read i; do seq $nr_loops -1 0 | while read i; do
out="$(_pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file1 2>&1)" out="$(_pwrite_byte 0x63 $((i * blksz)) $blksz $testdir/file1 2>&1)"
echo $out >> $seqres.full echo $out >> $seqres.full
echo $out | grep -q "No space left" && touch $testdir/abort echo $out | grep -q "No space left" && touch $abort_file
echo $out | grep -qi "error" && touch $testdir/abort echo $out | grep -qi "error" && touch $abort_file
test -e $testdir/abort && break test -e $abort_file && break
done done
test -e $testdir/abort && break test -e $abort_file && break
done done
touch $testdir/finished touch $finished_file
wait wait
# success, all done # success, all done