qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL for-2.5 4/4] iotests: Add regresion test case for write notifier assertion failure
Date: Thu,  3 Dec 2015 13:00:02 +0800	[thread overview]
Message-ID: <1449118802-12047-5-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1449118802-12047-1-git-send-email-stefanha@redhat.com>

From: Fam Zheng <famz@redhat.com>

The idea is to let the top level bs have a big request alignment with
blkdebug, so that the aio_write request issued from monitor will be
serialised. This tests that QEMU doesn't crash upon the read request
from the backup job's write notifier, which is a very special case of
"reentrant" request.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1448962590-2842-4-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 tests/qemu-iotests/056     | 25 +++++++++++++++++++++++++
 tests/qemu-iotests/056.out |  4 ++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056
index 54e4bd0..04f2c3c 100755
--- a/tests/qemu-iotests/056
+++ b/tests/qemu-iotests/056
@@ -82,6 +82,31 @@ class TestSyncModesNoneAndTop(iotests.QMPTestCase):
         time.sleep(1)
         self.assertEqual(-1, qemu_io('-c', 'read -P0x41 0 512', target_img).find("verification failed"))
 
+class TestBeforeWriteNotifier(iotests.QMPTestCase):
+    def setUp(self):
+        self.vm = iotests.VM().add_drive_raw("file=blkdebug::null-co://,id=drive0,align=65536,driver=blkdebug")
+        self.vm.launch()
+
+    def tearDown(self):
+        self.vm.shutdown()
+        os.remove(target_img)
+
+    def test_before_write_notifier(self):
+        self.vm.pause_drive("drive0")
+        result = self.vm.qmp('drive-backup', device='drive0',
+                             sync='full', target=target_img,
+                             format="file", speed=1)
+        self.assert_qmp(result, 'return', {})
+        result = self.vm.qmp('block-job-pause', device="drive0")
+        self.assert_qmp(result, 'return', {})
+        # Speed is low enough that this must be an uncopied range, which will
+        # trigger the before write notifier
+        self.vm.hmp_qemu_io('drive0', 'aio_write -P 1 512512 512')
+        self.vm.resume_drive("drive0")
+        result = self.vm.qmp('block-job-resume', device="drive0")
+        self.assert_qmp(result, 'return', {})
+        event = self.cancel_and_wait()
+        self.assert_qmp(event, 'data/type', 'backup')
 
 if __name__ == '__main__':
     iotests.main(supported_fmts=['qcow2', 'qed'])
diff --git a/tests/qemu-iotests/056.out b/tests/qemu-iotests/056.out
index fbc63e6..8d7e996 100644
--- a/tests/qemu-iotests/056.out
+++ b/tests/qemu-iotests/056.out
@@ -1,5 +1,5 @@
-..
+...
 ----------------------------------------------------------------------
-Ran 2 tests
+Ran 3 tests
 
 OK
-- 
2.5.0

  parent reply	other threads:[~2015-12-03  5:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03  4:59 [Qemu-devel] [PULL for-2.5 0/4] Block patches Stefan Hajnoczi
2015-12-03  4:59 ` [Qemu-devel] [PULL for-2.5 1/4] iothread: include id in thread name Stefan Hajnoczi
2015-12-07  9:58   ` Cornelia Huck
2015-12-03  5:00 ` [Qemu-devel] [PULL for-2.5 2/4] block: Don't wait serialising for non-COR read requests Stefan Hajnoczi
2015-12-07 10:02   ` Cornelia Huck
2015-12-07 16:42     ` Cornelia Huck
2015-12-08  2:08       ` Fam Zheng
2015-12-08  9:59       ` Kevin Wolf
2015-12-08 12:00         ` Cornelia Huck
2015-12-08 12:30           ` Christian Borntraeger
2015-12-08 13:28             ` Christian Borntraeger
2015-12-08 13:45               ` Kevin Wolf
2015-12-08 13:58                 ` Christian Borntraeger
2015-12-08 14:03                   ` Christian Borntraeger
2015-12-08 14:10                   ` Kevin Wolf
2015-12-08 14:24                     ` Christian Borntraeger
2015-12-08 14:38                       ` Cornelia Huck
2015-12-08 14:15                 ` Peter Maydell
2015-12-03  5:00 ` [Qemu-devel] [PULL for-2.5 3/4] iotests: Add "add_drive_raw" method Stefan Hajnoczi
2015-12-03  5:00 ` Stefan Hajnoczi [this message]
2015-12-03 11:53 ` [Qemu-devel] [PULL for-2.5 0/4] Block patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449118802-12047-5-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).