summaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/109
diff options
context:
space:
mode:
authorCleber Rosa <crosa@redhat.com>2017-08-01 17:31:27 -0400
committerKevin Wolf <kwolf@redhat.com>2017-08-08 14:36:59 +0200
commit53dd4015acb48bad5aee5ba707848370dc442077 (patch)
treeb43684c4705a5bc6e32014349f4005cb724911bd /tests/qemu-iotests/109
parentb4174c4b08a719e7df7e4f35c29f44b7c2517237 (diff)
qemu-iotests/109: Fix lock race condition
A race condition is currently present between the clean up attempt of the QEMU process and the execution of qemu-img. The actual (bad) output is: -Warning: Image size mismatch! -Images are identical. +qemu-img: Could not open '<build_dir>/tests/qemu-iotests/scratch/t.raw': Failed to get "consistent read" lock +Is another process using the image? A KILL signal is sent to the QEMU process, but qemu-img may begin to run before the QEMU process is really gone. qemu-img will then attempt to open the TEST_IMG file before it can secure a lock on it. This attempts a more graceful shutdown, and waits for the QEMU process to exit. Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/109')
-rwxr-xr-xtests/qemu-iotests/1093
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109
index 3b496a3918..d70b574d88 100755
--- a/tests/qemu-iotests/109
+++ b/tests/qemu-iotests/109
@@ -67,7 +67,8 @@ function run_qemu()
_send_qemu_cmd $QEMU_HANDLE '' "BLOCK_JOB_COMPLETED"
fi
_send_qemu_cmd $QEMU_HANDLE '{"execute":"query-block-jobs"}' "return"
- _cleanup_qemu
+ _send_qemu_cmd $QEMU_HANDLE '{"execute":"quit"}' "return"
+ wait=1 _cleanup_qemu
}
for fmt in qcow qcow2 qed vdi vmdk vpc; do