From nobody Thu Dec 18 17:48:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525793706358828.6596257891437; Tue, 8 May 2018 08:35:06 -0700 (PDT) Received: from localhost ([::1]:51932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4dt-00071T-Et for importer@patchew.org; Tue, 08 May 2018 11:35:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4PJ-0002A3-4J for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG4PI-0004ZU-6l for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36988) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fG4PD-0004Un-HR; Tue, 08 May 2018 11:19:55 -0400 Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B86D732FA321; Tue, 8 May 2018 15:19:54 +0000 (UTC) Received: from localhost (ovpn-117-144.phx2.redhat.com [10.3.117.144]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E1FA30012CE; Tue, 8 May 2018 15:19:26 +0000 (UTC) From: Jeff Cody To: qemu-block@nongnu.org Date: Tue, 8 May 2018 11:19:21 -0400 Message-Id: <20180508151924.18741-2-jcody@redhat.com> In-Reply-To: <20180508151924.18741-1-jcody@redhat.com> References: <20180508151924.18741-1-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 08 May 2018 15:19:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/4] block/mirror: honor ratelimit again X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , peter.maydell@linaro.org, sheepdog@lists.wpkg.org, Hitoshi Mitake , Jeff Cody , qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi , Liu Yuan , Liang Li Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefan Hajnoczi Commit b76e4458b1eb3c32e9824fe6aa51f67d2b251748 ("block/mirror: change the semantic of 'force' of block-job-cancel") accidentally removed the ratelimit in the mirror job. Reintroduce the ratelimit but keep the block-job-cancel force=3Dtrue behavior that was added in commit b76e4458b1eb3c32e9824fe6aa51f67d2b251748. Note that block_job_sleep_ns() returns immediately when the job is cancelled. Therefore it's safe to unconditionally call block_job_sleep_ns() - a cancelled job does not sleep. This commit fixes the non-deterministic qemu-iotests 185 output. The test relies on the ratelimit to make the job sleep until the 'quit' command is processed. Previously the job could complete before the 'quit' command was received since there was no ratelimit. Cc: Liang Li Cc: Jeff Cody Cc: Kevin Wolf Signed-off-by: Stefan Hajnoczi Message-id: 20180424123527.19168-1-stefanha@redhat.com Signed-off-by: Jeff Cody --- block/mirror.c | 8 +++++--- tests/qemu-iotests/185.out | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 820f512c7b..9436a8d5ee 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -868,12 +868,14 @@ static void coroutine_fn mirror_run(void *opaque) } =20 ret =3D 0; + + if (s->synced && !should_complete) { + delay_ns =3D (s->in_flight =3D=3D 0 && cnt =3D=3D 0 ? SLICE_TI= ME : 0); + } trace_mirror_before_sleep(s, cnt, s->synced, delay_ns); + block_job_sleep_ns(&s->common, delay_ns); if (block_job_is_cancelled(&s->common) && s->common.force) { break; - } else if (!should_complete) { - delay_ns =3D (s->in_flight =3D=3D 0 && cnt =3D=3D 0 ? SLICE_TI= ME : 0); - block_job_sleep_ns(&s->common, delay_ns); } s->last_pause_ns =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); } diff --git a/tests/qemu-iotests/185.out b/tests/qemu-iotests/185.out index 2c4b04de73..992162f418 100644 --- a/tests/qemu-iotests/185.out +++ b/tests/qemu-iotests/185.out @@ -36,9 +36,9 @@ Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D6710886= 4 backing_file=3DTEST_DIR/t.q {"return": {}} Formatting 'TEST_DIR/t.qcow2.copy', fmt=3Dqcow2 size=3D67108864 cluster_si= ze=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_JOB_READY", "data": {"device": "disk", "len": 4194304, "offset": 4= 194304, "speed": 65536, "type": "mirror"}} -{"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_JOB_COMPLETED", "data": {"device": "disk", "len": 4194304, "offset= ": 4194304, "speed": 65536, "type": "mirror"}} =20 =3D=3D=3D Start backup job and exit qemu =3D=3D=3D --=20 2.13.6 From nobody Thu Dec 18 17:48:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525793488197159.50086342388795; Tue, 8 May 2018 08:31:28 -0700 (PDT) Received: from localhost ([::1]:51918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4aN-0004QQ-60 for importer@patchew.org; Tue, 08 May 2018 11:31:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4PJ-00029y-2D for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG4PI-0004ZJ-0w for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fG4PE-0004VY-Er; Tue, 08 May 2018 11:19:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 95C023003A3B; Tue, 8 May 2018 15:19:55 +0000 (UTC) Received: from localhost (ovpn-117-144.phx2.redhat.com [10.3.117.144]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63A7D5D70C; Tue, 8 May 2018 15:19:55 +0000 (UTC) From: Jeff Cody To: qemu-block@nongnu.org Date: Tue, 8 May 2018 11:19:22 -0400 Message-Id: <20180508151924.18741-3-jcody@redhat.com> In-Reply-To: <20180508151924.18741-1-jcody@redhat.com> References: <20180508151924.18741-1-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 08 May 2018 15:19:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/4] block/mirror: Make cancel always cancel pre-READY X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , peter.maydell@linaro.org, sheepdog@lists.wpkg.org, Hitoshi Mitake , Jeff Cody , qemu-devel@nongnu.org, Max Reitz , Liu Yuan , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Max Reitz Commit b76e4458b1eb3c32e9824fe6aa51f67d2b251748 made the mirror block job respect block-job-cancel's @force flag: With that flag set, it would now always really cancel, even post-READY. Unfortunately, it had a side effect: Without that flag set, it would now never cancel, not even before READY. Considering that is an incompatible change and not noted anywhere in the commit or the description of block-job-cancel's @force parameter, this seems unintentional and we should revert to the previous behavior, which is to immediately cancel the job when block-job-cancel is called before source and target are in sync (i.e. before the READY event). Cc: qemu-stable@nongnu.org Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1572856 Reported-by: Yanan Fu Signed-off-by: Max Reitz Reviewed-by: Eric Blake Message-id: 20180501220509.14152-2-mreitz@redhat.com Reviewed-by: Jeff Cody Signed-off-by: Jeff Cody --- block/mirror.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/mirror.c b/block/mirror.c index 9436a8d5ee..99da9c0858 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -874,7 +874,9 @@ static void coroutine_fn mirror_run(void *opaque) } trace_mirror_before_sleep(s, cnt, s->synced, delay_ns); block_job_sleep_ns(&s->common, delay_ns); - if (block_job_is_cancelled(&s->common) && s->common.force) { + if (block_job_is_cancelled(&s->common) && + (!s->synced || s->common.force)) + { break; } s->last_pause_ns =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); --=20 2.13.6 From nobody Thu Dec 18 17:48:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525793684915626.6533194328517; Tue, 8 May 2018 08:34:44 -0700 (PDT) Received: from localhost ([::1]:51931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4dU-0006iF-2X for importer@patchew.org; Tue, 08 May 2018 11:34:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4PK-0002BF-8G for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG4PI-0004Zp-Ld for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43387) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fG4PF-0004WT-AG; Tue, 08 May 2018 11:19:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A5D381DFB; Tue, 8 May 2018 15:19:56 +0000 (UTC) Received: from localhost (ovpn-117-144.phx2.redhat.com [10.3.117.144]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 426F916E24; Tue, 8 May 2018 15:19:56 +0000 (UTC) From: Jeff Cody To: qemu-block@nongnu.org Date: Tue, 8 May 2018 11:19:23 -0400 Message-Id: <20180508151924.18741-4-jcody@redhat.com> In-Reply-To: <20180508151924.18741-1-jcody@redhat.com> References: <20180508151924.18741-1-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 08 May 2018 15:19:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/4] iotests: Add test for cancelling a mirror job X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , peter.maydell@linaro.org, sheepdog@lists.wpkg.org, Hitoshi Mitake , Jeff Cody , qemu-devel@nongnu.org, Max Reitz , Liu Yuan Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Max Reitz We already have an extensive mirror test (041) which does cover cancelling a mirror job, especially after it has emitted the READY event. However, it does not check what exact events are emitted after block-job-cancel is executed. More importantly, it does not use throttling to ensure that it covers the case of block-job-cancel before READY. It would be possible to add this case to 041, but considering it is already our largest test file, it makes sense to create a new file for these cases. Signed-off-by: Max Reitz Message-id: 20180501220509.14152-3-mreitz@redhat.com Signed-off-by: Jeff Cody --- tests/qemu-iotests/218 | 138 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/218.out | 30 ++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 169 insertions(+) create mode 100644 tests/qemu-iotests/218 create mode 100644 tests/qemu-iotests/218.out diff --git a/tests/qemu-iotests/218 b/tests/qemu-iotests/218 new file mode 100644 index 0000000000..92c331b6fb --- /dev/null +++ b/tests/qemu-iotests/218 @@ -0,0 +1,138 @@ +#!/usr/bin/env python +# +# This test covers what happens when a mirror block job is cancelled +# in various phases of its existence. +# +# Note that this test only checks the emitted events (i.e. +# BLOCK_JOB_COMPLETED vs. BLOCK_JOB_CANCELLED), it does not compare +# whether the target is in sync with the source when the +# BLOCK_JOB_COMPLETED event occurs. This is covered by other tests +# (such as 041). +# +# Copyright (C) 2018 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Creator/Owner: Max Reitz + +import iotests +from iotests import log + +iotests.verify_platform(['linux']) + + +# Launches the VM, adds two null-co nodes (source and target), and +# starts a blockdev-mirror job on them. +# +# Either both or none of speed and buf_size must be given. + +def start_mirror(vm, speed=3DNone, buf_size=3DNone): + vm.launch() + + ret =3D vm.qmp('blockdev-add', + node_name=3D'source', + driver=3D'null-co', + size=3D1048576) + assert ret['return'] =3D=3D {} + + ret =3D vm.qmp('blockdev-add', + node_name=3D'target', + driver=3D'null-co', + size=3D1048576) + assert ret['return'] =3D=3D {} + + if speed is not None: + ret =3D vm.qmp('blockdev-mirror', + job_id=3D'mirror', + device=3D'source', + target=3D'target', + sync=3D'full', + speed=3Dspeed, + buf_size=3Dbuf_size) + else: + ret =3D vm.qmp('blockdev-mirror', + job_id=3D'mirror', + device=3D'source', + target=3D'target', + sync=3D'full') + + assert ret['return'] =3D=3D {} + + +log('') +log('=3D=3D=3D Cancel mirror job before convergence =3D=3D=3D') +log('') + +log('--- force=3Dfalse ---') +log('') + +with iotests.VM() as vm: + # Low speed so it does not converge + start_mirror(vm, 65536, 65536) + + log('Cancelling job') + log(vm.qmp('block-job-cancel', device=3D'mirror', force=3DFalse)) + + log(vm.event_wait('BLOCK_JOB_CANCELLED'), + filters=3D[iotests.filter_qmp_event]) + +log('') +log('--- force=3Dtrue ---') +log('') + +with iotests.VM() as vm: + # Low speed so it does not converge + start_mirror(vm, 65536, 65536) + + log('Cancelling job') + log(vm.qmp('block-job-cancel', device=3D'mirror', force=3DTrue)) + + log(vm.event_wait('BLOCK_JOB_CANCELLED'), + filters=3D[iotests.filter_qmp_event]) + + +log('') +log('=3D=3D=3D Cancel mirror job after convergence =3D=3D=3D') +log('') + +log('--- force=3Dfalse ---') +log('') + +with iotests.VM() as vm: + start_mirror(vm) + + log(vm.event_wait('BLOCK_JOB_READY'), + filters=3D[iotests.filter_qmp_event]) + + log('Cancelling job') + log(vm.qmp('block-job-cancel', device=3D'mirror', force=3DFalse)) + + log(vm.event_wait('BLOCK_JOB_COMPLETED'), + filters=3D[iotests.filter_qmp_event]) + +log('') +log('--- force=3Dtrue ---') +log('') + +with iotests.VM() as vm: + start_mirror(vm) + + log(vm.event_wait('BLOCK_JOB_READY'), + filters=3D[iotests.filter_qmp_event]) + + log('Cancelling job') + log(vm.qmp('block-job-cancel', device=3D'mirror', force=3DTrue)) + + log(vm.event_wait('BLOCK_JOB_CANCELLED'), + filters=3D[iotests.filter_qmp_event]) diff --git a/tests/qemu-iotests/218.out b/tests/qemu-iotests/218.out new file mode 100644 index 0000000000..7dbf78e682 --- /dev/null +++ b/tests/qemu-iotests/218.out @@ -0,0 +1,30 @@ + +=3D=3D=3D Cancel mirror job before convergence =3D=3D=3D + +--- force=3Dfalse --- + +Cancelling job +{u'return': {}} +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u= 'device': u'mirror', u'type': u'mirror', u'speed': 65536, u'len': 1048576, = u'offset': 65536}, u'event': u'BLOCK_JOB_CANCELLED'} + +--- force=3Dtrue --- + +Cancelling job +{u'return': {}} +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u= 'device': u'mirror', u'type': u'mirror', u'speed': 65536, u'len': 1048576, = u'offset': 65536}, u'event': u'BLOCK_JOB_CANCELLED'} + +=3D=3D=3D Cancel mirror job after convergence =3D=3D=3D + +--- force=3Dfalse --- + +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u= 'device': u'mirror', u'type': u'mirror', u'speed': 0, u'len': 1048576, u'of= fset': 1048576}, u'event': u'BLOCK_JOB_READY'} +Cancelling job +{u'return': {}} +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u= 'device': u'mirror', u'type': u'mirror', u'speed': 0, u'len': 1048576, u'of= fset': 1048576}, u'event': u'BLOCK_JOB_COMPLETED'} + +--- force=3Dtrue --- + +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u= 'device': u'mirror', u'type': u'mirror', u'speed': 0, u'len': 1048576, u'of= fset': 1048576}, u'event': u'BLOCK_JOB_READY'} +Cancelling job +{u'return': {}} +{u'timestamp': {u'seconds': 'SECS', u'microseconds': 'USECS'}, u'data': {u= 'device': u'mirror', u'type': u'mirror', u'speed': 0, u'len': 1048576, u'of= fset': 1048576}, u'event': u'BLOCK_JOB_CANCELLED'} diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 52a80f3f9e..5daef24020 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -212,3 +212,4 @@ 211 rw auto quick 212 rw auto quick 213 rw auto quick +218 rw auto quick --=20 2.13.6 From nobody Thu Dec 18 17:48:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525793507577398.40500285215285; Tue, 8 May 2018 08:31:47 -0700 (PDT) Received: from localhost ([::1]:51919 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4ag-0004gl-QL for importer@patchew.org; Tue, 08 May 2018 11:31:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4PJ-0002A5-4a for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG4PI-0004Ze-BP for qemu-devel@nongnu.org; Tue, 08 May 2018 11:20:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37024) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fG4PG-0004XF-6B; Tue, 08 May 2018 11:19:58 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E4D4319D3DC; Tue, 8 May 2018 15:19:57 +0000 (UTC) Received: from localhost (ovpn-117-144.phx2.redhat.com [10.3.117.144]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 388077656F; Tue, 8 May 2018 15:19:57 +0000 (UTC) From: Jeff Cody To: qemu-block@nongnu.org Date: Tue, 8 May 2018 11:19:24 -0400 Message-Id: <20180508151924.18741-5-jcody@redhat.com> In-Reply-To: <20180508151924.18741-1-jcody@redhat.com> References: <20180508151924.18741-1-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 08 May 2018 15:19:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/4] sheepdog: Fix sd_co_create_opts() memory leaks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , peter.maydell@linaro.org, sheepdog@lists.wpkg.org, Hitoshi Mitake , Jeff Cody , qemu-devel@nongnu.org, Max Reitz , Liu Yuan Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Kevin Wolf Both the option string for the 'redundancy' option and the SheepdogRedundancy object that is created accordingly could be leaked in error paths. This fixes the memory leaks. Reported by Coverity (CID 1390614 and 1390641). Signed-off-by: Kevin Wolf Message-id: 20180503153509.22223-1-kwolf@redhat.com Reviewed-by: Jeff Cody Signed-off-by: Jeff Cody --- block/sheepdog.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index 07529f4b1b..fed2a04797 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1987,6 +1987,7 @@ static SheepdogRedundancy *parse_redundancy_str(const= char *opt) } else { ret =3D qemu_strtol(n2, NULL, 10, &parity); if (ret < 0) { + g_free(redundancy); return NULL; } =20 @@ -2183,7 +2184,7 @@ static int coroutine_fn sd_co_create_opts(const char = *filename, QemuOpts *opts, QDict *qdict, *location_qdict; QObject *crumpled; Visitor *v; - const char *redundancy; + char *redundancy; Error *local_err =3D NULL; int ret; =20 @@ -2253,6 +2254,7 @@ static int coroutine_fn sd_co_create_opts(const char = *filename, QemuOpts *opts, fail: qapi_free_BlockdevCreateOptions(create_options); qobject_unref(qdict); + g_free(redundancy); return ret; } =20 --=20 2.13.6