From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3hMt-000492-Jl for qemu-devel@nongnu.org; Tue, 01 Dec 2015 04:37:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3hMs-0006S5-6l for qemu-devel@nongnu.org; Tue, 01 Dec 2015 04:37:03 -0500 From: Fam Zheng Date: Tue, 1 Dec 2015 17:36:30 +0800 Message-Id: <1448962590-2842-4-git-send-email-famz@redhat.com> In-Reply-To: <1448962590-2842-1-git-send-email-famz@redhat.com> References: <1448962590-2842-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH 3/3] iotests: Add regresion test case for write notifier assertion failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , qemu-block@nongnu.org, Stefan Hajnoczi 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 --- 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.4.3