Skip to content

Commit

Permalink
t/zbd: avoid test case 45 failure
Browse files Browse the repository at this point in the history
When zonemode=zbd option is not specified, random writes to zoned block
devices fail because writes to sequential write required zones shall
happen only at write pointers. Randomly chosen write addresses do not
match with the write pointers, then fail. On such failures, fio prints
out the message below and tell users how to avoid the failures:

    "fio: first I/O failed. If .* is a zoned block device, consider --zonemode=zbd".

The test case 45 in t/zbd/test-zbd-support confirms the message is
printed when the first random write command to a sequential write
required zone fails. However, the random write can succeed very rarely
since the randomly chosen write address can be same as the write pointer
address. For example, a zoned block device with 1MB zone size with 4KB
block size device can have the first random write at write pointer with
ratio of 4KB/1MB = 1/256. This causes sporadic test case failures.

Avoid the failures by two changes. Firstly, change the random write
range from a zone to whole sequential write required zones to reduce the
failure ratio. Secondly, repeat the test if the message is not printed
by the accidental write success. As the test repeated, failure ratio is
multiplied and the failure ratio becomes as small as it can be ignored.

Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vincent Fu <[email protected]>
  • Loading branch information
kawasaki authored and vincentkfu committed Oct 13, 2023
1 parent 16b9f29 commit 50b9430
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions t/zbd/test-zbd-support
Original file line number Diff line number Diff line change
Expand Up @@ -1058,15 +1058,20 @@ test44() {

test45() {
local bs i
local grep_str="fio: first I/O failed. If .* is a zoned block device, consider --zonemode=zbd"

require_zbd || return $SKIP_TESTCASE
prep_write
bs=$((min_seq_write_size))
run_one_fio_job "$(ioengine "psync")" --iodepth=1 --rw=randwrite --bs=$bs\
--offset=$((first_sequential_zone_sector * 512)) \
--size="$zone_size" --do_verify=1 --verify=md5 2>&1 |
tee -a "${logfile}.${test_number}" |
grep -q "fio: first I/O failed. If .* is a zoned block device, consider --zonemode=zbd"
for ((i = 0; i < 10; i++)); do
run_one_fio_job "$(ioengine "psync")" --iodepth=1 --rw=randwrite \
--offset=$((first_sequential_zone_sector * 512)) \
--bs="$bs" --time_based --runtime=1s \
--do_verify=1 --verify=md5 \
>> "${logfile}.${test_number}" 2>&1
grep -qe "$grep_str" "${logfile}.${test_number}" && return 0
done
return 1
}

# Random write to sequential zones, libaio, 8 jobs, queue depth 64 per job
Expand Down

0 comments on commit 50b9430

Please sign in to comment.