-#!/bin/bash
+#!/usr/bin/env bash
#
# qcow2 error path testing
#
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
# Currently only qcow2 supports rebasing
_supported_fmt qcow2
_supported_proto file
-_supported_os Linux
-_default_cache_mode "writethrough"
-_supported_cache_modes "writethrough" "none"
+_default_cache_mode writethrough
+_supported_cache_modes writethrough none
# The refcount table tests expect a certain minimum width for refcount entries
# (so that the refcount table actually needs to grow); that minimum is 16 bits,
# being the default refcount entry width.
echo
-echo === Refcout table growth tests ===
+echo === Refcount table growth tests ===
echo
CLUSTER_SIZE=512
done
done
+echo
+echo === Avoid cluster leaks after temporary failure ===
+echo
+
+cat > "$TEST_DIR/blkdebug.conf" <<EOF
+[inject-error]
+event = "write_aio"
+errno = "5"
+once = "on"
+EOF
+
+# After the failed first write, do a second write so that the updated refcount
+# block is actually written back
+_make_test_img 64M
+$QEMU_IO -c "write 0 1M" -c "write 0 1M" "$BLKDBG_TEST_IMG" | _filter_qemu_io
+_check_test_img
+
# success, all done
echo "*** done"
rm -f $seq.full