From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553011149528604.1279095856116; Tue, 19 Mar 2019 08:59:09 -0700 (PDT) Received: from localhost ([127.0.0.1]:59352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H8o-0007Uy-EV for importer@patchew.org; Tue, 19 Mar 2019 11:59:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H1u-0001yp-Jc for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:51:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6H1l-0002od-6R for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:51:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20929) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gwp-0004UG-Vi; Tue, 19 Mar 2019 11:46:40 -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 AD729307EA89; Tue, 19 Mar 2019 15:46:30 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id C33EC5C1A1; Tue, 19 Mar 2019 15:46:29 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:09 +0100 Message-Id: <20190319154620.23991-2-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.44]); Tue, 19 Mar 2019 15:46:30 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/12] mirror: Confirm we're quiesced only if the job is paused or cancelled 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Sergio Lopez While child_job_drained_begin() calls to job_pause(), the job doesn't actually transition between states until it runs again and reaches a pause point. This means bdrv_drained_begin() may return with some jobs using the node still having 'busy =3D=3D true'. As a consequence, block_job_detach_aio_context() may get into a deadlock, waiting for the job to be actually paused, while the coroutine servicing the job is yielding and doesn't get the opportunity to get scheduled again. This situation can be reproduced by issuing a 'block-commit' immediately followed by a 'device_del'. To ensure bdrv_drained_begin() only returns when the jobs have been paused, we change mirror_drained_poll() to only confirm it's quiesced when job->paused =3D=3D true and there aren't any in-flight requests, except if we reached that point by a drained section initiated by the mirror/commit job itself. The other block jobs shouldn't need any changes, as the default drained_poll() behavior is to only confirm it's quiesced if the job is not busy or completed. Signed-off-by: Sergio Lopez Signed-off-by: Kevin Wolf --- block/mirror.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/block/mirror.c b/block/mirror.c index 010fdafd79..eb9a4cdf56 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -80,6 +80,7 @@ typedef struct MirrorBlockJob { bool initial_zeroing_ongoing; int in_active_write_counter; bool prepared; + bool in_drain; } MirrorBlockJob; =20 typedef struct MirrorBDSOpaque { @@ -683,6 +684,7 @@ static int mirror_exit_common(Job *job) =20 /* The mirror job has no requests in flight any more, but we need = to * drain potential other users of the BDS before changing the grap= h. */ + assert(s->in_drain); bdrv_drained_begin(target_bs); bdrv_replace_node(to_replace, target_bs, &local_err); bdrv_drained_end(target_bs); @@ -721,6 +723,7 @@ static int mirror_exit_common(Job *job) bs_opaque->job =3D NULL; =20 bdrv_drained_end(src); + s->in_drain =3D false; bdrv_unref(mirror_top_bs); bdrv_unref(src); =20 @@ -1004,10 +1007,12 @@ static int coroutine_fn mirror_run(Job *job, Error = **errp) */ trace_mirror_before_drain(s, cnt); =20 + s->in_drain =3D true; bdrv_drained_begin(bs); cnt =3D bdrv_get_dirty_count(s->dirty_bitmap); if (cnt > 0 || mirror_flush(s) < 0) { bdrv_drained_end(bs); + s->in_drain =3D false; continue; } =20 @@ -1055,6 +1060,7 @@ immediate_exit: bdrv_dirty_iter_free(s->dbi); =20 if (need_drain) { + s->in_drain =3D true; bdrv_drained_begin(bs); } =20 @@ -1123,6 +1129,16 @@ static void coroutine_fn mirror_pause(Job *job) static bool mirror_drained_poll(BlockJob *job) { MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common); + + /* If the job isn't paused nor cancelled, we can't be sure that it won= 't + * issue more requests. We make an exception if we've reached this poi= nt + * from one of our own drain sections, to avoid a deadlock waiting for + * ourselves. + */ + if (!s->common.job.paused && !s->common.job.cancelled && !s->in_drain)= { + return true; + } + return !!s->in_flight; } =20 --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553011256968134.13621215577461; Tue, 19 Mar 2019 09:00:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:59402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6HAV-0000PP-V5 for importer@patchew.org; Tue, 19 Mar 2019 12:00:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H1q-0001wg-UE for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:51:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6H1l-0002nT-0Z for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:51:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21744) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gwq-0004Uz-3i; Tue, 19 Mar 2019 11:46:40 -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 DA8E83087933; Tue, 19 Mar 2019 15:46:31 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFBB05C1A1; Tue, 19 Mar 2019 15:46:30 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:10 +0100 Message-Id: <20190319154620.23991-3-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.45]); Tue, 19 Mar 2019 15:46:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 02/12] qcow2: Fix data file error condition in qcow2_co_create() 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We were trying to check whether bdrv_open_blockdev_ref() returned success, but accidentally checked the wrong variable. Spotted by Coverity (CID 1399703). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella --- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/qcow2.c b/block/qcow2.c index 0dd77c6367..d507ee0686 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3073,7 +3073,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options= , Error **errp) goto out; } data_bs =3D bdrv_open_blockdev_ref(qcow2_opts->data_file, errp); - if (bs =3D=3D NULL) { + if (data_bs =3D=3D NULL) { ret =3D -EIO; goto out; } --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155301101228158.38777268439412; Tue, 19 Mar 2019 08:56:52 -0700 (PDT) Received: from localhost ([127.0.0.1]:59334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H6e-0005m4-Aw for importer@patchew.org; Tue, 19 Mar 2019 11:56:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H1u-0001yn-Jd for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:51:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6H1l-0002nh-1F for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:51:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47606) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gwp-0004Vr-UI; Tue, 19 Mar 2019 11:46:40 -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 132EDF74DD; Tue, 19 Mar 2019 15:46:33 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28C725C1A1; Tue, 19 Mar 2019 15:46:32 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:11 +0100 Message-Id: <20190319154620.23991-4-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.38]); Tue, 19 Mar 2019 15:46:33 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/12] qapi: fix block-latency-histogram-set description and examples 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy There no @device parameter, only the @id one. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- qapi/block-core.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 12c5e73551..7ccbfff9d0 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -565,7 +565,7 @@ # # Manage read, write and flush latency histograms for the device. # -# If only @device parameter is specified, remove all present latency histo= grams +# If only @id parameter is specified, remove all present latency histograms # for the device. Otherwise, add/reset some of (or all) latency histograms. # # @id: The name or QOM path of the guest device. @@ -597,7 +597,7 @@ # [0, 10), [10, 50), [50, 100), [100, +inf): # # -> { "execute": "block-latency-histogram-set", -# "arguments": { "device": "drive0", +# "arguments": { "id": "drive0", # "boundaries": [10, 50, 100] } } # <- { "return": {} } # @@ -605,7 +605,7 @@ # not changed (or not created): # # -> { "execute": "block-latency-histogram-set", -# "arguments": { "device": "drive0", +# "arguments": { "id": "drive0", # "boundaries-write": [10, 50, 100] } } # <- { "return": {} } # @@ -614,7 +614,7 @@ # write: [0, 1000), [1000, 5000), [5000, +inf) # # -> { "execute": "block-latency-histogram-set", -# "arguments": { "device": "drive0", +# "arguments": { "id": "drive0", # "boundaries": [10, 50, 100], # "boundaries-write": [1000, 5000] } } # <- { "return": {} } @@ -622,7 +622,7 @@ # Example: remove all latency histograms: # # -> { "execute": "block-latency-histogram-set", -# "arguments": { "device": "drive0" } } +# "arguments": { "id": "drive0" } } # <- { "return": {} } ## { 'command': 'block-latency-histogram-set', --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553011043138760.654786091434; Tue, 19 Mar 2019 08:57:23 -0700 (PDT) Received: from localhost ([127.0.0.1]:59340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H79-000696-66 for importer@patchew.org; Tue, 19 Mar 2019 11:57:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H21-00027F-GE for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:52:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6H1u-00035F-L7 for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:51:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41638) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gwr-0004YL-Nz; Tue, 19 Mar 2019 11:46:42 -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 431FB309266A; Tue, 19 Mar 2019 15:46:35 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 562B65C1A1; Tue, 19 Mar 2019 15:46:33 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:12 +0100 Message-Id: <20190319154620.23991-5-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.43]); Tue, 19 Mar 2019 15:46:35 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/12] vmdk: Support version=3 in VMDK descriptor files 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Sam Eiderman Commit 509d39aa22909c0ed1aabf896865f19c81fb38a1 added support for read only VMDKs of version 3. This commit fixes the probe function to correctly handle descriptors of version 3. This commit has two effects: 1. We no longer need to supply '-f vmdk' when pointing to descriptor files of version 3 in qemu/qemu-img command line arguments. 2. This fixes the scenario where a VMDK points to a parent version 3 descriptor file which is being probed as "raw" instead of "vmdk". Reviewed-by: Arbel Moshe Reviewed-by: Mark Kanda Signed-off-by: Shmuel Eiderman Signed-off-by: Kevin Wolf --- block/vmdk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index d8c0c50390..8dec6ef767 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -195,13 +195,15 @@ static int vmdk_probe(const uint8_t *buf, int buf_siz= e, const char *filename) } if (end - p >=3D strlen("version=3DX\n")) { if (strncmp("version=3D1\n", p, strlen("version=3D1\n")) = =3D=3D 0 || - strncmp("version=3D2\n", p, strlen("version=3D2\n")) = =3D=3D 0) { + strncmp("version=3D2\n", p, strlen("version=3D2\n")) = =3D=3D 0 || + strncmp("version=3D3\n", p, strlen("version=3D3\n")) = =3D=3D 0) { return 100; } } if (end - p >=3D strlen("version=3DX\r\n")) { if (strncmp("version=3D1\r\n", p, strlen("version=3D1\r\n"= )) =3D=3D 0 || - strncmp("version=3D2\r\n", p, strlen("version=3D2\r\n"= )) =3D=3D 0) { + strncmp("version=3D2\r\n", p, strlen("version=3D2\r\n"= )) =3D=3D 0 || + strncmp("version=3D3\r\n", p, strlen("version=3D3\r\n"= )) =3D=3D 0) { return 100; } } --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553010592502977.0876448944501; Tue, 19 Mar 2019 08:49:52 -0700 (PDT) Received: from localhost ([127.0.0.1]:59201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6Gzo-00085S-Fq for importer@patchew.org; Tue, 19 Mar 2019 11:49:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6Gx3-0006PW-QM for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6Gx0-00051Y-KM for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35396) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gwr-0004Zc-8F; Tue, 19 Mar 2019 11:46:41 -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 814003087935; Tue, 19 Mar 2019 15:46:37 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8630C5C1A1; Tue, 19 Mar 2019 15:46:35 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:13 +0100 Message-Id: <20190319154620.23991-6-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.45]); Tue, 19 Mar 2019 15:46:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/12] block: Silence Coverity in bdrv_drop_intermediate() 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Coverity doesn't like that the return value of bdrv_check_update_perm() stays unused only in this place (CID 1399710). Even if checking local_err should be equivalent to checking ret < 0, let's switch to using the return value to be more consistent (and in case of a bug somewhere down the call chain, forgetting to assign errp is more likely than returning 0 for an error case). Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Reviewed-by: Peter Maydell Reviewed-by: Markus Armbruster --- block.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index ed9253c786..0a93ee9ac8 100644 --- a/block.c +++ b/block.c @@ -4350,11 +4350,10 @@ int bdrv_drop_intermediate(BlockDriverState *top, B= lockDriverState *base, QLIST_FOREACH_SAFE(c, &top->parents, next_parent, next) { /* Check whether we are allowed to switch c from top to base */ GSList *ignore_children =3D g_slist_prepend(NULL, c); - bdrv_check_update_perm(base, NULL, c->perm, c->shared_perm, - ignore_children, &local_err); + ret =3D bdrv_check_update_perm(base, NULL, c->perm, c->shared_perm, + ignore_children, &local_err); g_slist_free(ignore_children); - if (local_err) { - ret =3D -EPERM; + if (ret < 0) { error_report_err(local_err); goto exit; } --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553010844923468.55378265506613; Tue, 19 Mar 2019 08:54:04 -0700 (PDT) Received: from localhost ([127.0.0.1]:59274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H3v-0003CH-N7 for importer@patchew.org; Tue, 19 Mar 2019 11:53:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6Gx3-0006PV-Pp for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6Gx0-00051d-Iu for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gwr-0004b3-Mg; Tue, 19 Mar 2019 11:46:42 -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 B09F7307C942; Tue, 19 Mar 2019 15:46:39 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id C26FC5C1A1; Tue, 19 Mar 2019 15:46:37 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:14 +0100 Message-Id: <20190319154620.23991-7-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.46]); Tue, 19 Mar 2019 15:46:39 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/12] iotests: 153: Wait for an answer to QMP commands 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Sergio Lopez There are various actions in this test that must be executed sequentially, as the result of it depends on the state triggered by the previous one. If the last argument of _send_qemu_cmd() is an empty string, it just sends the QMP commands without waiting for an answer. While unlikely, it may happen that the next action in the test gets invoked before QEMU processes the QMP request. This issue seems to be easier to reproduce on servers with limited resources or highly loaded. With this change, we wait for an answer on all _send_qemu_cmd() calls. Signed-off-by: Sergio Lopez Signed-off-by: Kevin Wolf --- tests/qemu-iotests/153 | 12 ++++++------ tests/qemu-iotests/153.out | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153 index c989c2495f..08ad8a6730 100755 --- a/tests/qemu-iotests/153 +++ b/tests/qemu-iotests/153 @@ -155,7 +155,7 @@ for opts1 in "" "read-only=3Don" "read-only=3Don,force-= share=3Don"; do _img_info -U | grep 'file format' fi done - _send_qemu_cmd $h "{ 'execute': 'quit', }" "" + _send_qemu_cmd $h "{ 'execute': 'quit' }" '' echo echo "Round done" _cleanup_qemu @@ -219,7 +219,7 @@ echo "Adding drive" _send_qemu_cmd $QEMU_HANDLE \ "{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_add 0 if=3Dnone,id=3Dd0,file= =3D${TEST_IMG}' } }" \ - "" + 'return' =20 _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512' =20 @@ -230,7 +230,7 @@ echo "=3D=3D Closing an image should unlock it =3D=3D" _send_qemu_cmd $QEMU_HANDLE \ "{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_del d0' } }" \ - "" + 'return' =20 _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512' =20 @@ -239,7 +239,7 @@ for d in d0 d1; do _send_qemu_cmd $QEMU_HANDLE \ "{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_add 0 if=3Dnone,id=3D$d,f= ile=3D${TEST_IMG},readonly=3Don' } }" \ - "" + 'return' done =20 _run_cmd $QEMU_IMG info "${TEST_IMG}" @@ -247,7 +247,7 @@ _run_cmd $QEMU_IMG info "${TEST_IMG}" _send_qemu_cmd $QEMU_HANDLE \ "{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_del d0' } }" \ - "" + 'return' =20 _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512' =20 @@ -255,7 +255,7 @@ echo "Closing the other" _send_qemu_cmd $QEMU_HANDLE \ "{ 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'drive_del d1' } }" \ - "" + 'return' =20 _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512' =20 diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out index 884254868c..9747ce3c41 100644 --- a/tests/qemu-iotests/153.out +++ b/tests/qemu-iotests/153.out @@ -417,6 +417,7 @@ Is another process using the image [TEST_DIR/t.qcow2]? _qemu_img_wrapper commit -b TEST_DIR/t.qcow2.b TEST_DIR/t.qcow2.c {"return": {}} Adding drive +{"return": "OKrn"} =20 _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 can't open device TEST_DIR/t.qcow2: Failed to get "write" lock @@ -425,16 +426,21 @@ Creating overlay with qemu-img when the guest is runn= ing should be allowed =20 _qemu_img_wrapper create -f qcow2 -b TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.ove= rlay =3D=3D Closing an image should unlock it =3D=3D +{"return": ""} =20 _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 Adding two and closing one +{"return": "OKrn"} +{"return": "OKrn"} =20 _qemu_img_wrapper info TEST_DIR/t.qcow2 +{"return": ""} =20 _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 can't open device TEST_DIR/t.qcow2: Failed to get "write" lock Is another process using the image [TEST_DIR/t.qcow2]? Closing the other +{"return": ""} =20 _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 =20 --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553010665484184.86977588890636; Tue, 19 Mar 2019 08:51:05 -0700 (PDT) Received: from localhost ([127.0.0.1]:59244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H14-0000ny-Ch for importer@patchew.org; Tue, 19 Mar 2019 11:51:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6Gx3-0006PR-Pf for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6Gx0-00051U-Jk for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50652) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gws-0004fo-Vm; Tue, 19 Mar 2019 11:46:43 -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 EA1E23086235; Tue, 19 Mar 2019 15:46:41 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id F28B45C1A1; Tue, 19 Mar 2019 15:46:39 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:15 +0100 Message-Id: <20190319154620.23991-8-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.42]); Tue, 19 Mar 2019 15:46:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/12] vl: Fix to create migration object before block backends 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Markus Armbruster Recent commit cda4aa9a5a0 moved block backend creation before machine property evaluation. This broke qemu-iotests 055. Turns out we need to create the migration object before block backends, so block backends can add migration blockers. Fix by calling migration_object_init() earlier, right before configure_blockdev(). Fixes: cda4aa9a5a08777cf13e164c0543bd4888b8adce Reported-by: Kevin Wolf Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- vl.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/vl.c b/vl.c index c1d5484e12..d61d5604e5 100644 --- a/vl.c +++ b/vl.c @@ -4276,10 +4276,17 @@ int main(int argc, char **argv, char **envp) exit(0); } =20 + /* + * Migration object can only be created after global properties + * are applied correctly. + */ + migration_object_init(); + /* * Note: we need to create block backends before * machine_set_property(), so machine properties can refer to - * them. + * them, and after migration_object_init(), so we can create + * migration blockers. */ configure_blockdev(&bdo_queue, machine_class, snapshot); =20 @@ -4297,12 +4304,6 @@ int main(int argc, char **argv, char **envp) machine_class->name, machine_class->deprecation_reaso= n); } =20 - /* - * Migration object can only be created after global properties - * are applied correctly. - */ - migration_object_init(); - if (qtest_chrdev) { qtest_init(qtest_chrdev, qtest_log, &error_fatal); } --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553011104961316.6525340647687; Tue, 19 Mar 2019 08:58:24 -0700 (PDT) Received: from localhost ([127.0.0.1]:59346 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H85-0006uA-HH for importer@patchew.org; Tue, 19 Mar 2019 11:58:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6GxB-0006YX-Dj for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:47:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6Gx7-0005F9-NM for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:47:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37998) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gwv-0004mB-4l; Tue, 19 Mar 2019 11:46:46 -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 32BE5307EA89; Tue, 19 Mar 2019 15:46:44 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38F0C5C1A1; Tue, 19 Mar 2019 15:46:42 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:16 +0100 Message-Id: <20190319154620.23991-9-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.44]); Tue, 19 Mar 2019 15:46:44 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/12] qemu-iotests: Fix 232 for non-qcow2 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 232 is marked as generic, but commit 12efe428c9e added code that assumes qcow2. What the new test really needs is backing files and support for updating the backing file link (.bdrv_change_backing_file). Split the non-generic code into a new test case 247 and make it work with qed, too. Signed-off-by: Kevin Wolf --- tests/qemu-iotests/232 | 30 --------------- tests/qemu-iotests/232.out | 20 ---------- tests/qemu-iotests/247 | 79 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/247.out | 22 +++++++++++ tests/qemu-iotests/group | 1 + 5 files changed, 102 insertions(+), 50 deletions(-) create mode 100755 tests/qemu-iotests/247 create mode 100644 tests/qemu-iotests/247.out diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232 index 0de097fc88..2063f78876 100755 --- a/tests/qemu-iotests/232 +++ b/tests/qemu-iotests/232 @@ -144,36 +144,6 @@ run_qemu_info_block -blockdev driver=3Dfile,filename= =3D"$TEST_IMG",node-name=3Dnode0,a run_qemu_info_block -blockdev driver=3Dfile,filename=3D"$TEST_IMG",node-na= me=3Dnode0,auto-read-only=3Don run_qemu_info_block -blockdev driver=3Dfile,filename=3D"$TEST_IMG",node-na= me=3Dnode0 =20 -echo -echo "=3D=3D=3D Try commit to backing file with auto-read-only =3D=3D=3D" -echo - -TEST_IMG=3D"$TEST_IMG.0" _make_test_img $size -TEST_IMG=3D"$TEST_IMG.1" _make_test_img $size -TEST_IMG=3D"$TEST_IMG.2" _make_test_img $size -TEST_IMG=3D"$TEST_IMG.3" _make_test_img $size -TEST_IMG=3D"$TEST_IMG.4" _make_test_img $size - -(cat <. +# + +# creator +owner=3Dkwolf@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img + rm -f $TEST_IMG.[01234] +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# Requires backing files and .bdrv_change_backing_file support +_supported_fmt qcow2 qed +_supported_proto file +_supported_os Linux + +size=3D128M + +echo +echo "=3D=3D=3D Try commit to backing file with auto-read-only =3D=3D=3D" +echo +TEST_IMG=3D"$TEST_IMG.0" _make_test_img $size +TEST_IMG=3D"$TEST_IMG.1" _make_test_img $size +TEST_IMG=3D"$TEST_IMG.2" _make_test_img $size +TEST_IMG=3D"$TEST_IMG.3" _make_test_img $size +TEST_IMG=3D"$TEST_IMG.4" _make_test_img $size + +(cat < Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553010777443673.841272343469; Tue, 19 Mar 2019 08:52:57 -0700 (PDT) Received: from localhost ([127.0.0.1]:59268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H2r-0002Kr-2T for importer@patchew.org; Tue, 19 Mar 2019 11:52:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6Gx5-0006Pz-PF for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6Gx3-00057Y-Oq for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38800) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gwx-0004s5-2f; Tue, 19 Mar 2019 11:46:47 -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 48C5731688E4; Tue, 19 Mar 2019 15:46:46 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 741DD5C1A1; Tue, 19 Mar 2019 15:46:44 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:17 +0100 Message-Id: <20190319154620.23991-10-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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, 19 Mar 2019 15:46:46 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/12] blockjob: fix user pause in block_job_error_action 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Job (especially mirror) may call block_job_error_action several times before actual pause if it has several in-flight requests. block_job_error_action will call job_pause more than once in this case, which lead to following block-job-resume qmp command can't actually resume the job. Fix it by do not increase pause level in block_job_error_action if user_paused already set. Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Kevin Wolf --- blockjob.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/blockjob.c b/blockjob.c index 58de8cb024..730101d282 100644 --- a/blockjob.c +++ b/blockjob.c @@ -501,9 +501,11 @@ BlockErrorAction block_job_error_action(BlockJob *job,= BlockdevOnError on_err, action); } if (action =3D=3D BLOCK_ERROR_ACTION_STOP) { - job_pause(&job->job); - /* make the pause user visible, which will be resumed from QMP. */ - job->job.user_paused =3D true; + if (!job->job.user_paused) { + job_pause(&job->job); + /* make the pause user visible, which will be resumed from QMP= . */ + job->job.user_paused =3D true; + } block_job_iostatus_set_err(job, error); } return action; --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553010968264337.00378208828954; Tue, 19 Mar 2019 08:56:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:59323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H5r-0004vm-6S for importer@patchew.org; Tue, 19 Mar 2019 11:55:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6Gx9-0006Wa-SS for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:47:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6Gx7-0005FC-N4 for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55302) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gwz-0004vI-Je; Tue, 19 Mar 2019 11:46:50 -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 7521513A42; Tue, 19 Mar 2019 15:46:47 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B6215C1A1; Tue, 19 Mar 2019 15:46:46 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:18 +0100 Message-Id: <20190319154620.23991-11-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.29]); Tue, 19 Mar 2019 15:46:47 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/12] block: Make bdrv_{copy_on_read, crypto_luks, replication} static 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Alberto Garcia Signed-off-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block/copy-on-read.c | 2 +- block/crypto.c | 2 +- block/replication.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 64dcc424b5..d670fec42b 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -134,7 +134,7 @@ static bool cor_recurse_is_first_non_filter(BlockDriver= State *bs, } =20 =20 -BlockDriver bdrv_copy_on_read =3D { +static BlockDriver bdrv_copy_on_read =3D { .format_name =3D "copy-on-read", =20 .bdrv_open =3D cor_open, diff --git a/block/crypto.c b/block/crypto.c index fd8c7cfac6..3af46b805f 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -625,7 +625,7 @@ static const char *const block_crypto_strong_runtime_op= ts[] =3D { NULL }; =20 -BlockDriver bdrv_crypto_luks =3D { +static BlockDriver bdrv_crypto_luks =3D { .format_name =3D "luks", .instance_size =3D sizeof(BlockCrypto), .bdrv_probe =3D block_crypto_probe_luks, diff --git a/block/replication.c b/block/replication.c index b95bd28802..3d4dedddfc 100644 --- a/block/replication.c +++ b/block/replication.c @@ -682,7 +682,7 @@ static const char *const replication_strong_runtime_opt= s[] =3D { NULL }; =20 -BlockDriver bdrv_replication =3D { +static BlockDriver bdrv_replication =3D { .format_name =3D "replication", .instance_size =3D sizeof(BDRVReplicationState), =20 --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553010889791385.25137580247815; Tue, 19 Mar 2019 08:54:49 -0700 (PDT) Received: from localhost ([127.0.0.1]:59284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6H4g-0003r3-LL for importer@patchew.org; Tue, 19 Mar 2019 11:54:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6GxB-0006Ya-EO for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:47:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6Gx9-0005IX-TG for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:47:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52132) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gx1-00051i-Vs; Tue, 19 Mar 2019 11:46:52 -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 4D8548762E; Tue, 19 Mar 2019 15:46:50 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id B838F5C1A1; Tue, 19 Mar 2019 15:46:47 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:19 +0100 Message-Id: <20190319154620.23991-12-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.26]); Tue, 19 Mar 2019 15:46:50 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 11/12] blockdev: Check @replaces in blockdev_mirror_common 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Reitz There is no reason why the constraints we put on @replaces should be limited to drive-mirror. Therefore, move the sanity checks from qmp_drive_mirror() to blockdev_mirror_common() so they apply to blockdev-mirror as well. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- blockdev.c | 55 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/blockdev.c b/blockdev.c index 53df2eb875..4775a07d93 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3756,6 +3756,39 @@ static void blockdev_mirror_common(const char *job_i= d, BlockDriverState *bs, sync =3D MIRROR_SYNC_MODE_FULL; } =20 + if (has_replaces) { + BlockDriverState *to_replace_bs; + AioContext *replace_aio_context; + int64_t bs_size, replace_size; + + bs_size =3D bdrv_getlength(bs); + if (bs_size < 0) { + error_setg_errno(errp, -bs_size, "Failed to query device's siz= e"); + return; + } + + to_replace_bs =3D check_to_replace_node(bs, replaces, errp); + if (!to_replace_bs) { + return; + } + + replace_aio_context =3D bdrv_get_aio_context(to_replace_bs); + aio_context_acquire(replace_aio_context); + replace_size =3D bdrv_getlength(to_replace_bs); + aio_context_release(replace_aio_context); + + if (replace_size < 0) { + error_setg_errno(errp, -replace_size, + "Failed to query the replacement node's size"= ); + return; + } + if (bs_size !=3D replace_size) { + error_setg(errp, "cannot replace image with a mirror image of " + "different size"); + return; + } + } + /* pass the node name to replace to mirror start since it's loose coup= ling * and will allow to check whether the node still exist at mirror comp= letion */ @@ -3816,33 +3849,11 @@ void qmp_drive_mirror(DriveMirror *arg, Error **err= p) } =20 if (arg->has_replaces) { - BlockDriverState *to_replace_bs; - AioContext *replace_aio_context; - int64_t replace_size; - if (!arg->has_node_name) { error_setg(errp, "a node-name must be provided when replacing = a" " named node of the graph"); goto out; } - - to_replace_bs =3D check_to_replace_node(bs, arg->replaces, &local_= err); - - if (!to_replace_bs) { - error_propagate(errp, local_err); - goto out; - } - - replace_aio_context =3D bdrv_get_aio_context(to_replace_bs); - aio_context_acquire(replace_aio_context); - replace_size =3D bdrv_getlength(to_replace_bs); - aio_context_release(replace_aio_context); - - if (size !=3D replace_size) { - error_setg(errp, "cannot replace image with a mirror image of " - "different size"); - goto out; - } } =20 if (arg->mode =3D=3D NEW_IMAGE_MODE_ABSOLUTE_PATHS) { --=20 2.20.1 From nobody Fri May 17 12:14:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553010592500707.9170745249992; Tue, 19 Mar 2019 08:49:52 -0700 (PDT) Received: from localhost ([127.0.0.1]:59203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6Gzo-00085d-CJ for importer@patchew.org; Tue, 19 Mar 2019 11:49:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6Gx9-0006Wb-Sl for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:47:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6Gx7-0005FS-PC for qemu-devel@nongnu.org; Tue, 19 Mar 2019 11:46:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38130) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6Gx3-00055C-Nz; Tue, 19 Mar 2019 11:46:54 -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 9254F30833C2; Tue, 19 Mar 2019 15:46:52 +0000 (UTC) Received: from dhcp-200-226.str.redhat.com (dhcp-200-226.str.redhat.com [10.33.200.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C7E35C1A1; Tue, 19 Mar 2019 15:46:50 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 19 Mar 2019 16:46:20 +0100 Message-Id: <20190319154620.23991-13-kwolf@redhat.com> In-Reply-To: <20190319154620.23991-1-kwolf@redhat.com> References: <20190319154620.23991-1-kwolf@redhat.com> MIME-Version: 1.0 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.44]); Tue, 19 Mar 2019 15:46:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 12/12] qemu-iotests: Treat custom TEST_DIR in 051 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: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Luk=C3=A1=C5=A1 Doktor When custom TEST_DIR is specified the output includes it without leading '/': $ TEST_DIR=3D/var/tmp ./check -file -qcow2 051 .... -drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}}, "driver": "qcow2", "file": {"driver": "file", "filename": SNAPSHOT_PATH}} (qcow2, read-only) +drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/vl.ziHfeP"}} (qcow2, read-only) Let's remove it from the sed regexp. Signed-off-by: Luk=C3=A1=C5=A1 Doktor Signed-off-by: Kevin Wolf --- tests/qemu-iotests/051 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 index 6a3b7c2b89..02ac960da4 100755 --- a/tests/qemu-iotests/051 +++ b/tests/qemu-iotests/051 @@ -360,7 +360,7 @@ TMPDIR=3D/nonexistent run_qemu -drive driver=3Dnull-co,= snapshot=3Don echo "info block" | run_qemu -drive file=3D"$TEST_IMG",snapshot=3Don,read-only=3Don,if=3Dn= one,id=3D$device_id | _filter_qemu_io | - sed -e 's#"/[^"]*/vl\.[A-Za-z0-9]\{6\}"#SNAPSHOT_PATH#g' + sed -e 's#"[^"]*/vl\.[A-Za-z0-9]\{6\}"#SNAPSHOT_PATH#g' =20 =20 # success, all done --=20 2.20.1