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

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