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 <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471428
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
GangCao 2019-10-16 13:38:26 -04:00 committed by Jim Harris
parent c8b6a884fd
commit 3fbc84d306
2 changed files with 12 additions and 1 deletions

View File

@ -124,7 +124,7 @@ if [ -d /usr/src/fio ]; then
timing_enter fio_rw_verify timing_enter fio_rw_verify
# Generate the fio config file given the list of all unclaimed bdevs # 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 for b in $(echo $bdevs | jq -r '.name'); do
fio_config_add_job $testdir/bdev.fio $b fio_config_add_job $testdir/bdev.fio $b
done done

View File

@ -727,6 +727,8 @@ function fio_config_gen()
{ {
local config_file=$1 local config_file=$1
local workload=$2 local workload=$2
local bdev_type=$3
local fio_dir="/usr/src/fio"
if [ -e "$config_file" ]; then if [ -e "$config_file" ]; then
echo "Configuration File Already Exists!: $config_file" echo "Configuration File Already Exists!: $config_file"
@ -754,6 +756,15 @@ EOL
echo "verify=sha1" >> $config_file echo "verify=sha1" >> $config_file
echo "verify_backlog=1024" >> $config_file echo "verify_backlog=1024" >> $config_file
echo "rw=randwrite" >> $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 elif [ "$workload" == "trim" ]; then
echo "rw=trimwrite" >> $config_file echo "rw=trimwrite" >> $config_file
else else