Blame SOURCES/kvm-qemu-iotests-reduce-chance-of-races-in-185.patch

1bdc94
From 03240b36532d828a71fd3c9fee7b1ed6e8faa7a5 Mon Sep 17 00:00:00 2001
1bdc94
From: Kevin Wolf <kwolf@redhat.com>
1bdc94
Date: Tue, 26 Jun 2018 09:47:45 +0200
1bdc94
Subject: [PATCH 16/89] qemu-iotests: reduce chance of races in 185
1bdc94
1bdc94
RH-Author: Kevin Wolf <kwolf@redhat.com>
1bdc94
Message-id: <20180626094856.6924-3-kwolf@redhat.com>
1bdc94
Patchwork-id: 81061
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 02/73] qemu-iotests: reduce chance of races in 185
1bdc94
Bugzilla: 1513543
1bdc94
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
1bdc94
RH-Acked-by: Max Reitz <mreitz@redhat.com>
1bdc94
RH-Acked-by: Fam Zheng <famz@redhat.com>
1bdc94
1bdc94
From: Stefan Hajnoczi <stefanha@redhat.com>
1bdc94
1bdc94
Commit 8565c3ab537e78f3e69977ec2c609dc9417a806e ("qemu-iotests: fix
1bdc94
185") identified a race condition in a sub-test.
1bdc94
1bdc94
Similar issues also affect the other sub-tests.  If disk I/O completes
1bdc94
quickly, it races with the QMP 'quit' command.  This causes spurious
1bdc94
test failures because QMP events are emitted in an unpredictable order.
1bdc94
1bdc94
This test relies on QEMU internals and there is no QMP API for getting
1bdc94
deterministic behavior needed to make this test 100% reliable.  At the
1bdc94
same time, the test is useful and it would be a shame to remove it.
1bdc94
1bdc94
Add sleep 0.5 to reduce the chance of races.  This is not a real fix but
1bdc94
appears to reduce spurious failures in practice.
1bdc94
1bdc94
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1bdc94
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
1bdc94
Reviewed-by: Eric Blake <eblake@redhat.com>
1bdc94
Message-id: 20180508135436.30140-2-stefanha@redhat.com
1bdc94
Reviewed-by: Jeff Cody <jcody@redhat.com>
1bdc94
Signed-off-by: Jeff Cody <jcody@redhat.com>
1bdc94
(cherry picked from commit ddf2d98a94c8a98a661a217fb629cfd15f4dcec7)
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 tests/qemu-iotests/185 | 12 ++++++++++++
1bdc94
 1 file changed, 12 insertions(+)
1bdc94
1bdc94
diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185
1bdc94
index 298d88d..975404c 100755
1bdc94
--- a/tests/qemu-iotests/185
1bdc94
+++ b/tests/qemu-iotests/185
1bdc94
@@ -118,6 +118,9 @@ _send_qemu_cmd $h \
1bdc94
                       'speed': 65536 } }" \
1bdc94
     "return"
1bdc94
 
1bdc94
+# If we don't sleep here 'quit' command races with disk I/O
1bdc94
+sleep 0.5
1bdc94
+
1bdc94
 _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
1bdc94
 wait=1 _cleanup_qemu
1bdc94
 
1bdc94
@@ -137,6 +140,9 @@ _send_qemu_cmd $h \
1bdc94
                       'speed': 65536 } }" \
1bdc94
     "return"
1bdc94
 
1bdc94
+# If we don't sleep here 'quit' command races with disk I/O
1bdc94
+sleep 0.5
1bdc94
+
1bdc94
 _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
1bdc94
 wait=1 _cleanup_qemu
1bdc94
 
1bdc94
@@ -183,6 +189,9 @@ _send_qemu_cmd $h \
1bdc94
                       'speed': 65536 } }" \
1bdc94
     "return"
1bdc94
 
1bdc94
+# If we don't sleep here 'quit' command races with disk I/O
1bdc94
+sleep 0.5
1bdc94
+
1bdc94
 _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
1bdc94
 wait=1 _cleanup_qemu
1bdc94
 
1bdc94
@@ -201,6 +210,9 @@ _send_qemu_cmd $h \
1bdc94
                       'speed': 65536 } }" \
1bdc94
     "return"
1bdc94
 
1bdc94
+# If we don't sleep here 'quit' command races with disk I/O
1bdc94
+sleep 0.5
1bdc94
+
1bdc94
 _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
1bdc94
 wait=1 _cleanup_qemu
1bdc94
 
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94