Skip to contentSkip to conversation

xfstests: aio random write and verify stress test

PATCH In review Zorro Lang 2 participants 3 messages May 13, 2019 – Jun 28, 2019

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH 1/1 xfstests: aio random write and verify stress test

We found some AIO write related bugs recently, so I think a AIO random write test is needed. By the new aio-aio-write-verify.c tool, we can do this easily.

---

Long time passed, re-send this to review again.

Thanks,
Zorro

 tests/generic/998     | 87 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/998.out |  2 +
 tests/generic/group   |  1 +
 3 files changed, 90 insertions(+)
 create mode 100755 tests/generic/998
 create mode 100644 tests/generic/998.out
tests/generic/998 new file +87 -0
new file mode 100755
index 00000000..54b79691
@@ -0,0 +1,87 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 998
+#
+# Randomly direct AIO write&verify stress test
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_aiodio aio-dio-write-verify
+
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount
+
+localfile=$SCRATCH_MNT/testfile
+diosize=`_min_dio_alignment $SCRATCH_DEV`
+
+# The maximum write size and offset are both 32k diosize. So the maximum
+# file size will be (32 * 2)k
+free_size_k=`df -kP $SCRATCH_MNT | grep -v Filesystem | awk '{print $4}'`
+max_io_size_b=$((32 * 1024))
+if [ $max_io_size_b -gt $((free_size_k * 1024 / 2 / diosize)) ]; then
+	max_io_size_b=$((free_size_k * 1024 / 2 / diosize))
+fi
+
+do_test()
+{
+	local num_oper
+	local oper_list=""
+	local size
+	local off
+	local truncsize
+
+	# the number of AIO write operation
+	num_oper=$((RANDOM % 64 + 1))
+
+	for ((i=0; i<num_oper; i++)); do
+		size=$(((RANDOM % max_io_size_b + 1) * diosize))
+		off=$((RANDOM % max_io_size_b * diosize))
+		oper_list="$oper_list -a size=$size,off=$off"
+	done
+	truncsize=$(((RANDOM * diosize + RANDOM % diosize) % max_io_size_b))
+
+	$AIO_TEST -t $truncsize $oper_list $localfile
+	if [ $? -ne 0 ];then
+		echo "$AIO_TEST -t $truncsize $oper_list $localfile"
+		echo "==========^^ Fail ^^=========="
+	fi
+}
+
+testimes=$((LOAD_FACTOR * 100))
+while [ $testimes -gt 0 ]; do
+	echo > $localfile
+	do_test
+	((testimes--))
+done
+
+echo "Silence is golden"
+
+# success, all done
+status=0
+exit
tests/generic/998.out new file +2 -0
new file mode 100644
index 00000000..d2679ae0
@@ -0,0 +1,2 @@
+QA output created by 998
+Silence is golden
tests/generic/group +1 -0
index 0c3016fd..36b180c3 100644
@@ -540,4 +540,5 @@
 535 auto quick log
 536 auto quick rw shutdown
 537 auto quick trim
+998 auto stress aio
 999 auto quick aio
Signature · 1 line
2.17.2
#1 lore raw
Quoted 5 lines · Zorro Lang

We found some AIO write related bugs recently, so I think a AIO random write test is needed. By the new aio-aio-write-verify.c tool, we can do this easily.

Is it just me or does this test gets killed by OOM killer for anyone else? (generic/551).

It always gets killed on a 2GB RAM VM and once got killed on 8GB RAM VM.

At least I can verify that Darrick's fix is working as expected ("check: try to insulate the test framework from oom killer")

Thanks,
Amir.

author
#2 lore raw
Quoted 11 lines · Amir Goldstein
Quoted 5 lines · Zorro Lang

We found some AIO write related bugs recently, so I think a AIO random write test is needed. By the new aio-aio-write-verify.c tool, we can do this easily.

Is it just me or does this test gets killed by OOM killer for anyone else? (generic/551).

It always gets killed on a 2GB RAM VM and once got killed on 8GB RAM VM.

Sorry, not only you. We've found that this case can cause OOM on low memeory machine. I'm going to reduce the default test stress, to avoid the OOM. If you already has a patch now, please feel free to cc me.

Thanks,
Zorro

Quoted 6 lines

At least I can verify that Darrick's fix is working as expected ("check: try to insulate the test framework from oom killer")

Thanks,
Amir.