From 3fbc84d306537d8df09b2ccc84c66e28aa88a513 Mon Sep 17 00:00:00 2001 From: GangCao Date: Wed, 16 Oct 2019 13:38:26 -0400 Subject: [PATCH] fio/bdev: fix the AIO bdev intermittent IO failure This is to solve below github issue: https://github.com/spdk/spdk/issues/935 Change-Id: I9b90f58c2756a415916d54ea49e62dbb467db4a0 Signed-off-by: GangCao Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471428 Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- test/bdev/blockdev.sh | 2 +- test/common/autotest_common.sh | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/bdev/blockdev.sh b/test/bdev/blockdev.sh index 0f8e56e41..43f1ab445 100755 --- a/test/bdev/blockdev.sh +++ b/test/bdev/blockdev.sh @@ -124,7 +124,7 @@ if [ -d /usr/src/fio ]; then timing_enter fio_rw_verify # Generate the fio config file given the list of all unclaimed bdevs - fio_config_gen $testdir/bdev.fio verify + fio_config_gen $testdir/bdev.fio verify AIO for b in $(echo $bdevs | jq -r '.name'); do fio_config_add_job $testdir/bdev.fio $b done diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 71eb83e5e..d3338b91e 100644 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -727,6 +727,8 @@ function fio_config_gen() { local config_file=$1 local workload=$2 + local bdev_type=$3 + local fio_dir="/usr/src/fio" if [ -e "$config_file" ]; then echo "Configuration File Already Exists!: $config_file" @@ -754,6 +756,15 @@ EOL echo "verify=sha1" >> $config_file echo "verify_backlog=1024" >> $config_file echo "rw=randwrite" >> $config_file + + # To avoid potential data race issue due to the AIO device + # flush mechanism, add the flag to serialize the writes. + # This is to fix the intermittent IO failure issue of #935 + if [ "$bdev_type" == "AIO" ]; then + if [[ $($fio_dir/fio --version) == *"fio-3"* ]]; then + echo "serialize_overlap=1" >> $config_file + fi + fi elif [ "$workload" == "trim" ]; then echo "rw=trimwrite" >> $config_file else