From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075116787282.34937208089195; Mon, 26 Mar 2018 07:38:36 -0700 (PDT) Received: from localhost ([::1]:57064 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TGd-0004Wq-VY for importer@patchew.org; Mon, 26 Mar 2018 10:38:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEM-0002wu-JL for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEL-0003u8-Hj for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35552 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEE-0003iF-P2; Mon, 26 Mar 2018 10:36:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56A6F406E8DB; Mon, 26 Mar 2018 14:36:06 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F7F37C50; Mon, 26 Mar 2018 14:36:05 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:42 +0200 Message-Id: <20180326143600.7724-2-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Mar 2018 14:36:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Mar 2018 14:36:06 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 01/19] iotests: 163 is not quick 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, qemu-devel@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: Eric Blake Testing on ext4, most 'quick' qcow2 tests took less than 5 seconds, but 163 took more than 20. Let's remove it from the quick set. Signed-off-by: Eric Blake Signed-off-by: Kevin Wolf --- tests/qemu-iotests/group | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index efe0e958f2..0c2983f4cd 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -167,7 +167,7 @@ 159 rw auto quick 160 rw auto quick 162 auto quick -163 rw auto quick +163 rw auto 165 rw auto quick 169 rw auto quick 170 rw auto quick --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075452983990.7305488139455; Mon, 26 Mar 2018 07:44:12 -0700 (PDT) Received: from localhost ([::1]:57104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TLw-0001Si-Oq for importer@patchew.org; Mon, 26 Mar 2018 10:44:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEN-0002yB-Ja for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEM-0003vj-IP for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:15 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35554 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEF-0003in-As; Mon, 26 Mar 2018 10:36:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2BB6406E8DB; Mon, 26 Mar 2018 14:36:06 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C3B77C5D; Mon, 26 Mar 2018 14:36:06 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:43 +0200 Message-Id: <20180326143600.7724-3-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Mar 2018 14:36:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Mar 2018 14:36:06 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 02/19] block/replication: Remove protocol_name field 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, qemu-devel@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: Fabiano Rosas The protocol_name field is used when selecting a driver via protocol syntax (i.e. :). Drivers that are only selected explicitly (e.g. driver=3Dreplication,mode=3Dprimary,...) should not have a protocol_name. This patch removes the protocol_name field from the brdv_replication structure so that attempts to invoke this driver using protocol syntax will fail gracefully: $ qemu-img info replication:foo qemu-img: Could not open 'replication:': Unknown protocol 'replication' Buglink: https://bugs.launchpad.net/qemu/+bug/1726733 Signed-off-by: Fabiano Rosas Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- replication.h | 1 - block/replication.c | 1 - 2 files changed, 2 deletions(-) diff --git a/replication.h b/replication.h index 8faefe005f..4c8354de23 100644 --- a/replication.h +++ b/replication.h @@ -67,7 +67,6 @@ typedef struct ReplicationState ReplicationState; * * BlockDriver bdrv_replication =3D { * .format_name =3D "replication", - * .protocol_name =3D "replication", * .instance_size =3D sizeof(BDRVReplicationState), * * .bdrv_open =3D replication_open, diff --git a/block/replication.c b/block/replication.c index f98ef094b9..6c0c7186d9 100644 --- a/block/replication.c +++ b/block/replication.c @@ -703,7 +703,6 @@ static void replication_stop(ReplicationState *rs, bool= failover, Error **errp) =20 BlockDriver bdrv_replication =3D { .format_name =3D "replication", - .protocol_name =3D "replication", .instance_size =3D sizeof(BDRVReplicationState), =20 .bdrv_open =3D replication_open, --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075109623709.9544861202342; Mon, 26 Mar 2018 07:38:29 -0700 (PDT) Received: from localhost ([::1]:57061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TGT-0004OY-Co for importer@patchew.org; Mon, 26 Mar 2018 10:38:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEJ-0002ua-Pf for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEI-0003mT-T5 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:11 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36846 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEG-0003jV-9Q; Mon, 26 Mar 2018 10:36:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF50D7705F; Mon, 26 Mar 2018 14:36:07 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A4007C58; Mon, 26 Mar 2018 14:36:07 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:44 +0200 Message-Id: <20180326143600.7724-4-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:07 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 03/19] block/quorum: Remove protocol-related fields 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, qemu-devel@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: Fabiano Rosas The quorum driver is not a protocol so it should implement bdrv_open instead of bdrv_file_open and not provide a protocol_name. Attempts to invoke this driver using protocol syntax (i.e. quorum:) will now fail gracefully: $ qemu-img info quorum:foo qemu-img: Could not open 'quorum:foo': Unknown protocol 'quorum' Signed-off-by: Fabiano Rosas Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block/quorum.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index 14333c18aa..cfe484a945 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -1098,11 +1098,10 @@ static void quorum_refresh_filename(BlockDriverStat= e *bs, QDict *options) =20 static BlockDriver bdrv_quorum =3D { .format_name =3D "quorum", - .protocol_name =3D "quorum", =20 .instance_size =3D sizeof(BDRVQuorumState), =20 - .bdrv_file_open =3D quorum_open, + .bdrv_open =3D quorum_open, .bdrv_close =3D quorum_close, .bdrv_refresh_filename =3D quorum_refresh_filename, =20 --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075613095559.4208042853166; Mon, 26 Mar 2018 07:46:53 -0700 (PDT) Received: from localhost ([::1]:57124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TOe-0004J1-9S for importer@patchew.org; Mon, 26 Mar 2018 10:46:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TES-00033Y-96 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TER-00043z-AM for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46504 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEH-0003kI-5e; Mon, 26 Mar 2018 10:36:09 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB7FF402314E; Mon, 26 Mar 2018 14:36:08 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 163007C5D; Mon, 26 Mar 2018 14:36:07 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:45 +0200 Message-Id: <20180326143600.7724-5-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:08 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 04/19] block/throttle: Remove protocol-related fields 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, qemu-devel@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: Fabiano Rosas The throttle driver is not a protocol so it should implement bdrv_open instead of bdrv_file_open and not provide a protocol_name. Attempts to invoke this driver using protocol syntax (i.e. throttle:) will now fail gracefully: $ qemu-img info throttle:foo qemu-img: Could not open 'throttle:foo': Unknown protocol 'throttle' Signed-off-by: Fabiano Rosas Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block/throttle.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/throttle.c b/block/throttle.c index 5f4d43d0fc..95ed06acd8 100644 --- a/block/throttle.c +++ b/block/throttle.c @@ -215,10 +215,9 @@ static void coroutine_fn throttle_co_drain_end(BlockDr= iverState *bs) =20 static BlockDriver bdrv_throttle =3D { .format_name =3D "throttle", - .protocol_name =3D "throttle", .instance_size =3D sizeof(ThrottleGroupMember), =20 - .bdrv_file_open =3D throttle_open, + .bdrv_open =3D throttle_open, .bdrv_close =3D throttle_close, .bdrv_co_flush =3D throttle_co_flush, =20 --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075120982866.7833857803823; Mon, 26 Mar 2018 07:38:40 -0700 (PDT) Received: from localhost ([::1]:57063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TGe-0004Vz-8I for importer@patchew.org; Mon, 26 Mar 2018 10:38:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEM-0002wV-0i for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEL-0003tH-9C for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36850 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEI-0003l2-2a; Mon, 26 Mar 2018 10:36:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A6F387705F; Mon, 26 Mar 2018 14:36:09 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 023B17C2D; Mon, 26 Mar 2018 14:36:08 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:46 +0200 Message-Id: <20180326143600.7724-6-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:09 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 05/19] block/blkreplay: Remove protocol-related fields 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, qemu-devel@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: Fabiano Rosas The blkreplay driver is not a protocol so it should implement bdrv_open instead of bdrv_file_open and not provide a protocol_name. Attempts to invoke this driver using protocol syntax (i.e. blkreplay:) will now fail gracefully: $ qemu-img info blkreplay:foo qemu-img: Could not open 'blkreplay:foo': Unknown protocol 'blkreplay' Signed-off-by: Fabiano Rosas Reviewed-by: Pavel Dovgalyuk Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block/blkreplay.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/blkreplay.c b/block/blkreplay.c index 61e44a1949..fe5a9b4a98 100755 --- a/block/blkreplay.c +++ b/block/blkreplay.c @@ -129,10 +129,9 @@ static int coroutine_fn blkreplay_co_flush(BlockDriver= State *bs) =20 static BlockDriver bdrv_blkreplay =3D { .format_name =3D "blkreplay", - .protocol_name =3D "blkreplay", .instance_size =3D 0, =20 - .bdrv_file_open =3D blkreplay_open, + .bdrv_open =3D blkreplay_open, .bdrv_close =3D blkreplay_close, .bdrv_child_perm =3D bdrv_filter_default_perms, .bdrv_getlength =3D blkreplay_getlength, --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075290488443.22285488270927; Mon, 26 Mar 2018 07:41:30 -0700 (PDT) Received: from localhost ([::1]:57089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TJM-0007Q7-Dn for importer@patchew.org; Mon, 26 Mar 2018 10:41:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEM-0002wh-Ak for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEL-0003tz-HM for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51566 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEJ-0003m6-0e; Mon, 26 Mar 2018 10:36:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 928638185352; Mon, 26 Mar 2018 14:36:10 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id E212C7C2D; Mon, 26 Mar 2018 14:36:09 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:47 +0200 Message-Id: <20180326143600.7724-7-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 26 Mar 2018 14:36:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 26 Mar 2018 14:36:10 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 06/19] include/block/block_int: Document protocol related functions 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, qemu-devel@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: Fabiano Rosas Clarify that: - for protocols the brdv_file_open function is used instead of bdrv_open; - when protocol_name is set, a driver should expect to be given only a filename and no other options. Signed-off-by: Fabiano Rosas Signed-off-by: Kevin Wolf --- include/block/block_int.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/block/block_int.h b/include/block/block_int.h index 27e17addba..c4dd1d4bb8 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -126,6 +126,8 @@ struct BlockDriver { =20 int (*bdrv_open)(BlockDriverState *bs, QDict *options, int flags, Error **errp); + + /* Protocol drivers should implement this instead of bdrv_open */ int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags, Error **errp); void (*bdrv_close)(BlockDriverState *bs); @@ -251,6 +253,12 @@ struct BlockDriver { */ int coroutine_fn (*bdrv_co_flush_to_os)(BlockDriverState *bs); =20 + /* + * Drivers setting this field must be able to work with just a plain + * filename with ':' as a prefix, and no other options. + * Options may be extracted from the filename by implementing + * bdrv_parse_filename. + */ const char *protocol_name; int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset, PreallocMode prealloc, Error **errp); --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075328552166.98968194443205; Mon, 26 Mar 2018 07:42:08 -0700 (PDT) Received: from localhost ([::1]:57092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TK3-000842-Hr for importer@patchew.org; Mon, 26 Mar 2018 10:42:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEV-00036Z-QH for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEU-0004Av-3o for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36852 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEJ-0003oK-Ud; Mon, 26 Mar 2018 10:36:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F0017705F; Mon, 26 Mar 2018 14:36:11 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDE387C2D; Mon, 26 Mar 2018 14:36:10 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:48 +0200 Message-Id: <20180326143600.7724-8-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:11 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 07/19] qcow2: Reset free_cluster_index when allocating a new refcount block 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, qemu-devel@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: Alberto Garcia When we try to allocate new clusters we first look for available ones starting from s->free_cluster_index and once we find them we increase their reference counts. Before we get to call update_refcount() to do this last step s->free_cluster_index is already pointing to the next cluster after the ones we are trying to allocate. During update_refcount() it may happen however that we also need to allocate a new refcount block in order to store the refcounts of these new clusters (and to complicate things further that may also require us to grow the refcount table). After all this we don't know if the clusters that we originally tried to allocate are still available, so we return -EAGAIN to ask the caller to restart the search for free clusters. This is what can happen in a common scenario: 1) We want to allocate a new cluster and we see that cluster N is free. 2) We try to increase N's refcount but all refcount blocks are full, so we allocate a new one at N+1 (where s->free_cluster_index was pointing at). 3) Once we're done we return -EAGAIN to look again for a free cluster, but now s->free_cluster_index points at N+2, so that's the one we allocate. Cluster N remains unallocated and we have a hole in the qcow2 file. This can be reproduced easily: qemu-img create -f qcow2 -o cluster_size=3D512 hd.qcow2 1M qemu-io -c 'write 0 124k' hd.qcow2 After this the image has 132608 bytes (256 clusters), and the refcount block is full. If we write 512 more bytes it should allocate two new clusters: the data cluster itself and a new refcount block. qemu-io -c 'write 124k 512' hd.qcow2 However the image has now three new clusters (259 in total), and the first one of them is empty (and unallocated): dd if=3Dhd.qcow2 bs=3D512c skip=3D256 count=3D1 | hexdump -C If we write larger amounts of data in the last step instead of the 512 bytes used in this example we can create larger holes in the qcow2 file. What this patch does is reset s->free_cluster_index to its previous value when alloc_refcount_block() returns -EAGAIN. This way the caller will try to allocate again the original clusters if they are still free. The output of iotest 026 also needs to be updated because now that images have no holes some tests fail at a different point and the number of leaked clusters is different. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- block/qcow2-refcount.c | 7 +++++++ tests/qemu-iotests/026.out | 6 +++--- tests/qemu-iotests/121 | 20 ++++++++++++++++++++ tests/qemu-iotests/121.out | 10 ++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 362deaf303..6b8b63514a 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -839,6 +839,13 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(Blo= ckDriverState *bs, qcow2_cache_put(s->refcount_block_cache, &refcount_block); } ret =3D alloc_refcount_block(bs, cluster_index, &refcount_bloc= k); + /* If the caller needs to restart the search for free clusters, + * try the same ones first to see if they're still free. */ + if (ret =3D=3D -EAGAIN) { + if (s->free_cluster_index > (start >> s->cluster_bits)) { + s->free_cluster_index =3D (start >> s->cluster_bits); + } + } if (ret < 0) { goto fail; } diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out index 86a50a2e13..8e89416a86 100644 --- a/tests/qemu-iotests/026.out +++ b/tests/qemu-iotests/026.out @@ -533,7 +533,7 @@ Failed to flush the L2 table cache: No space left on de= vice Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 -11 leaked clusters were found on the image. +10 leaked clusters were found on the image. This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 @@ -561,7 +561,7 @@ Failed to flush the L2 table cache: No space left on de= vice Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 -11 leaked clusters were found on the image. +10 leaked clusters were found on the image. This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 @@ -589,7 +589,7 @@ Failed to flush the L2 table cache: No space left on de= vice Failed to flush the refcount block cache: No space left on device write failed: No space left on device =20 -11 leaked clusters were found on the image. +10 leaked clusters were found on the image. This means waste of disk space, but no harm to data. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121 index 1307b4e327..6d6f55a5dc 100755 --- a/tests/qemu-iotests/121 +++ b/tests/qemu-iotests/121 @@ -93,6 +93,26 @@ $QEMU_IO -c 'write 63M 130K' "$TEST_IMG" | _filter_qemu_= io =20 _check_test_img =20 +echo +echo '=3D=3D=3D Allocating a new refcount block must not leave holes in th= e image =3D=3D=3D' +echo + +IMGOPTS=3D'cluster_size=3D512,refcount_bits=3D16' _make_test_img 1M + +# This results in an image with 256 used clusters: the qcow2 header, +# the refcount table, one refcount block, the L1 table, four L2 tables +# and 248 data clusters +$QEMU_IO -c 'write 0 124k' "$TEST_IMG" | _filter_qemu_io + +# 256 clusters of 512 bytes each give us a 128K image +stat -c "size=3D%s (expected 131072)" $TEST_IMG + +# All 256 entries of the refcount block are used, so writing a new +# data cluster also allocates a new refcount block +$QEMU_IO -c 'write 124k 512' "$TEST_IMG" | _filter_qemu_io + +# Two more clusters, the image size should be 129K now +stat -c "size=3D%s (expected 132096)" $TEST_IMG =20 # success, all done echo diff --git a/tests/qemu-iotests/121.out b/tests/qemu-iotests/121.out index 5961a44cd9..613d56185e 100644 --- a/tests/qemu-iotests/121.out +++ b/tests/qemu-iotests/121.out @@ -20,4 +20,14 @@ wrote 133120/133120 bytes at offset 66060288 130 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) No errors were found on the image. =20 +=3D=3D=3D Allocating a new refcount block must not leave holes in the imag= e =3D=3D=3D + +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 +wrote 126976/126976 bytes at offset 0 +124 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +size=3D131072 (expected 131072) +wrote 512/512 bytes at offset 126976 +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +size=3D132096 (expected 132096) + *** done --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075818766926.4194632828139; Mon, 26 Mar 2018 07:50:18 -0700 (PDT) Received: from localhost ([::1]:57139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TRn-0007At-P7 for importer@patchew.org; Mon, 26 Mar 2018 10:50:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TER-00032U-5g for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEN-0003yb-Kb for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47456 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEK-0003rK-VH; Mon, 26 Mar 2018 10:36:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8BC494068024; Mon, 26 Mar 2018 14:36:12 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE8AA7C5D; Mon, 26 Mar 2018 14:36:11 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:49 +0200 Message-Id: <20180326143600.7724-9-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 26 Mar 2018 14:36:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 26 Mar 2018 14:36:12 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 08/19] vdi: Change 'static' create option to 'preallocation' in QMP 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, qemu-devel@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" What static=3Don really does is what we call metadata preallocation for other block drivers. While we can still change the QMP interface, make it more consistent by using 'preallocation' for VDI, too. This doesn't implement any new functionality, so the only supported preallocation modes are 'off' and 'metadata' for now. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- qapi/block-core.json | 7 +++---- block/vdi.c | 24 ++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 1088ab0c78..c50517bff3 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3943,16 +3943,15 @@ # # @file Node to create the image format on # @size Size of the virtual disk in bytes -# @static Whether to create a statically (true) or -# dynamically (false) allocated image -# (default: false, i.e. dynamic) +# @preallocation Preallocation mode for the new image (allowed values: = off, +# metadata; default: off) # # Since: 2.12 ## { 'struct': 'BlockdevCreateOptionsVdi', 'data': { 'file': 'BlockdevRef', 'size': 'size', - '*static': 'bool' } } + '*preallocation': 'PreallocMode' } } =20 ## # @BlockdevVhdxSubformat: diff --git a/block/vdi.c b/block/vdi.c index d939b034c4..73c059e69d 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -728,7 +728,7 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreate= Options *create_options, int ret =3D 0; uint64_t bytes =3D 0; uint32_t blocks; - uint32_t image_type =3D VDI_TYPE_DYNAMIC; + uint32_t image_type; VdiHeader header; size_t i; size_t bmap_size; @@ -744,9 +744,22 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreat= eOptions *create_options, =20 /* Validate options and set default values */ bytes =3D vdi_opts->size; - if (vdi_opts->q_static) { + + if (!vdi_opts->has_preallocation) { + vdi_opts->preallocation =3D PREALLOC_MODE_OFF; + } + switch (vdi_opts->preallocation) { + case PREALLOC_MODE_OFF: + image_type =3D VDI_TYPE_DYNAMIC; + break; + case PREALLOC_MODE_METADATA: image_type =3D VDI_TYPE_STATIC; + break; + default: + error_setg(errp, "Preallocation mode not supported for vdi"); + return -EINVAL; } + #ifndef CONFIG_VDI_STATIC_IMAGE if (image_type =3D=3D VDI_TYPE_STATIC) { ret =3D -ENOTSUP; @@ -874,6 +887,7 @@ static int coroutine_fn vdi_co_create_opts(const char *= filename, QemuOpts *opts, BlockdevCreateOptions *create_options =3D NULL; BlockDriverState *bs_file =3D NULL; uint64_t block_size =3D DEFAULT_CLUSTER_SIZE; + bool is_static =3D false; Visitor *v; Error *local_err =3D NULL; int ret; @@ -895,6 +909,9 @@ static int coroutine_fn vdi_co_create_opts(const char *= filename, QemuOpts *opts, goto done; } #endif + if (qemu_opt_get_bool_del(opts, BLOCK_OPT_STATIC, false)) { + is_static =3D true; + } =20 qdict =3D qemu_opts_to_qdict_filtered(opts, NULL, &vdi_create_opts, tr= ue); =20 @@ -913,6 +930,9 @@ static int coroutine_fn vdi_co_create_opts(const char *= filename, QemuOpts *opts, =20 qdict_put_str(qdict, "driver", "vdi"); qdict_put_str(qdict, "file", bs_file->node_name); + if (is_static) { + qdict_put_str(qdict, "preallocation", "metadata"); + } =20 /* Get the QAPI object */ v =3D qobject_input_visitor_new_keyval(QOBJECT(qdict)); --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152207511660159.02657185152111; Mon, 26 Mar 2018 07:38:36 -0700 (PDT) Received: from localhost ([::1]:57062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TGd-0004VX-P0 for importer@patchew.org; Mon, 26 Mar 2018 10:38:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TES-00033X-8L for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TER-00044L-Cg for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36854 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEL-0003uN-TH; Mon, 26 Mar 2018 10:36:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 77E6277067; Mon, 26 Mar 2018 14:36:13 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id C73C07C58; Mon, 26 Mar 2018 14:36:12 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:50 +0200 Message-Id: <20180326143600.7724-10-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:13 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 09/19] vdi: Fix build with CONFIG_VDI_DEBUG 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, qemu-devel@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" Use qemu_uuid_unparse() instead of uuid_unparse() to make vdi.c compile again when CONFIG_VDI_DEBUG is set. In order to prevent future bitrot, replace '#ifdef CONFIG_VDI_DEBUG' by 'if (VDI_DEBUG)' so that the compiler always sees the code. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/vdi.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/block/vdi.c b/block/vdi.c index 73c059e69d..4a2d1ff88d 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -235,7 +235,6 @@ static void vdi_header_to_le(VdiHeader *header) qemu_uuid_bswap(&header->uuid_parent); } =20 -#if defined(CONFIG_VDI_DEBUG) static void vdi_header_print(VdiHeader *header) { char uuid[37]; @@ -257,16 +256,15 @@ static void vdi_header_print(VdiHeader *header) logout("block extra 0x%04x\n", header->block_extra); logout("blocks tot. 0x%04x\n", header->blocks_in_image); logout("blocks all. 0x%04x\n", header->blocks_allocated); - uuid_unparse(header->uuid_image, uuid); + qemu_uuid_unparse(&header->uuid_image, uuid); logout("uuid image %s\n", uuid); - uuid_unparse(header->uuid_last_snap, uuid); + qemu_uuid_unparse(&header->uuid_last_snap, uuid); logout("uuid snap %s\n", uuid); - uuid_unparse(header->uuid_link, uuid); + qemu_uuid_unparse(&header->uuid_link, uuid); logout("uuid link %s\n", uuid); - uuid_unparse(header->uuid_parent, uuid); + qemu_uuid_unparse(&header->uuid_parent, uuid); logout("uuid parent %s\n", uuid); } -#endif =20 static int coroutine_fn vdi_co_check(BlockDriverState *bs, BdrvCheckResult= *res, BdrvCheckMode fix) @@ -387,9 +385,9 @@ static int vdi_open(BlockDriverState *bs, QDict *option= s, int flags, } =20 vdi_header_to_cpu(&header); -#if defined(CONFIG_VDI_DEBUG) - vdi_header_print(&header); -#endif + if (VDI_DEBUG) { + vdi_header_print(&header); + } =20 if (header.disk_size > VDI_DISK_SIZE_MAX) { error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64 @@ -825,9 +823,9 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreate= Options *create_options, qemu_uuid_generate(&header.uuid_image); qemu_uuid_generate(&header.uuid_last_snap); /* There is no need to set header.uuid_link or header.uuid_parent here= . */ -#if defined(CONFIG_VDI_DEBUG) - vdi_header_print(&header); -#endif + if (VDI_DEBUG) { + vdi_header_print(&header); + } vdi_header_to_le(&header); ret =3D blk_pwrite(blk, offset, &header, sizeof(header), 0); if (ret < 0) { --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075821453287.5492437783938; Mon, 26 Mar 2018 07:50:21 -0700 (PDT) Received: from localhost ([::1]:57140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TS0-0007ON-H9 for importer@patchew.org; Mon, 26 Mar 2018 10:50:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEW-00037N-6X for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEU-0004Bx-BE for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46506 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEM-0003vn-SU; Mon, 26 Mar 2018 10:36:14 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66FBB402314E; Mon, 26 Mar 2018 14:36:14 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id B35F67C2D; Mon, 26 Mar 2018 14:36:13 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:51 +0200 Message-Id: <20180326143600.7724-11-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:14 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 10/19] qemu-iotests: Test vdi image creation with QMP 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, qemu-devel@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" Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- tests/qemu-iotests/211 | 246 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/211.out | 97 ++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 344 insertions(+) create mode 100755 tests/qemu-iotests/211 create mode 100644 tests/qemu-iotests/211.out diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211 new file mode 100755 index 0000000000..1edec26517 --- /dev/null +++ b/tests/qemu-iotests/211 @@ -0,0 +1,246 @@ +#!/bin/bash +# +# Test VDI and file image creation +# +# 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=3Dkwolf@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # failure is the default! + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt vdi +_supported_proto file +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" + $QEMU -nographic -qmp stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \ + | _filter_qemu | _filter_imgfmt \ + | _filter_actual_image_size +} + +echo +echo "=3D=3D=3D Successful image creation (defaults) =3D=3D=3D" +echo + +size=3D$((128 * 1024 * 1024)) + +run_qemu < Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075490251128.92747935870523; Mon, 26 Mar 2018 07:44:50 -0700 (PDT) Received: from localhost ([::1]:57107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TMf-0002Hj-Cu for importer@patchew.org; Mon, 26 Mar 2018 10:44:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEV-00035l-5S for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEU-0004Bq-9I for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47460 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEN-0003yJ-PH; Mon, 26 Mar 2018 10:36:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 553BF4068030; Mon, 26 Mar 2018 14:36:15 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id A39497C2D; Mon, 26 Mar 2018 14:36:14 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:52 +0200 Message-Id: <20180326143600.7724-12-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 26 Mar 2018 14:36:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 26 Mar 2018 14:36:15 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 11/19] qemu-iotests: Enable 025 for luks 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, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We want to test resizing even for luks. The only change that is needed is to explicitly zero out new space for luks because it's undefined. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/qemu-iotests/025 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025 index f5e672e6b3..70dd5f10aa 100755 --- a/tests/qemu-iotests/025 +++ b/tests/qemu-iotests/025 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter . ./common.pattern =20 -_supported_fmt raw qcow2 qed +_supported_fmt raw qcow2 qed luks _supported_proto file sheepdog rbd nfs _supported_os Linux =20 @@ -62,6 +62,13 @@ length EOF _check_test_img =20 +# bdrv_truncate() doesn't zero the new space, so we need to do that explic= itly. +# We still want to test automatic zeroing for other formats even though +# bdrv_truncate() doesn't guarantee it. +if [ "$IMGFMT" =3D=3D "luks" ]; then + $QEMU_IO -c "write -z $small_size $((big_size - small_size))" "$TEST_I= MG" > /dev/null +fi + echo echo "=3D=3D=3D Verifying image size after reopen" $QEMU_IO -c "length" "$TEST_IMG" --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522076122423808.4076765074366; Mon, 26 Mar 2018 07:55:22 -0700 (PDT) Received: from localhost ([::1]:57175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TWj-00038Q-3I for importer@patchew.org; Mon, 26 Mar 2018 10:55:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEW-00038Z-Un for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEW-0004Ec-4I for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46512 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEO-0003zg-M4; Mon, 26 Mar 2018 10:36:16 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41A4E4023150; Mon, 26 Mar 2018 14:36:16 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9052B7C5D; Mon, 26 Mar 2018 14:36:15 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:53 +0200 Message-Id: <20180326143600.7724-13-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:16 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 12/19] luks: Turn another invalid assertion into check 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, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit e39e959e fixed an invalid assertion in the .bdrv_length implementation, but left a similar assertion in place for .bdrv_truncate. Instead of crashing when the user requests a too large image size, fail gracefully. A file size of exactly INT64_MAX caused failure before, but is actually legal. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 --- block/crypto.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/crypto.c b/block/crypto.c index e0b8856f74..bc6c7e3795 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -357,7 +357,11 @@ static int block_crypto_truncate(BlockDriverState *bs,= int64_t offset, BlockCrypto *crypto =3D bs->opaque; uint64_t payload_offset =3D qcrypto_block_get_payload_offset(crypto->block); - assert(payload_offset < (INT64_MAX - offset)); + + if (payload_offset > INT64_MAX - offset) { + error_setg(errp, "The requested file size is too large"); + return -EFBIG; + } =20 offset +=3D payload_offset; =20 --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15220756407374.7925473727005965; Mon, 26 Mar 2018 07:47:20 -0700 (PDT) Received: from localhost ([::1]:57127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TP5-0004iT-Tj for importer@patchew.org; Mon, 26 Mar 2018 10:47:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEV-00035r-81 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEU-0004BZ-8O for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46514 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEP-00040V-Jx; Mon, 26 Mar 2018 10:36:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D8A64023141; Mon, 26 Mar 2018 14:36:17 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C3D27C2D; Mon, 26 Mar 2018 14:36:16 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:54 +0200 Message-Id: <20180326143600.7724-14-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:17 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 13/19] qemu-iotests: Test invalid resize on luks 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, qemu-devel@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" This tests that the .bdrv_truncate implementation for luks doesn't crash for invalid image sizes. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- tests/qemu-iotests/210 | 37 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/210.out | 16 ++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/tests/qemu-iotests/210 b/tests/qemu-iotests/210 index 96a5213e77..e607c0d296 100755 --- a/tests/qemu-iotests/210 +++ b/tests/qemu-iotests/210 @@ -204,6 +204,43 @@ run_qemu -blockdev driver=3Dfile,filename=3D"$TEST_IMG= _FILE",node-name=3Dnode0 \ { "execute": "quit" } EOF =20 +echo +echo "=3D=3D=3D Resize image with invalid sizes =3D=3D=3D" +echo + +run_qemu -blockdev driver=3Dfile,filename=3D"$TEST_IMG_FILE",node-name=3Dn= ode0 \ + -blockdev driver=3Dluks,file=3Dnode0,key-secret=3Dkeysec0,node-na= me=3Dnode1 \ + -object secret,id=3Dkeysec0,data=3D"foo" <0= size"}} +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false}} + +image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "T= EST_DIR/t.IMGFMT"}, "key-secret": "keysec0"} +file format: IMGFMT +virtual size: 0 (0 bytes) *** done --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075988878618.7052588606522; Mon, 26 Mar 2018 07:53:08 -0700 (PDT) Received: from localhost ([::1]:57166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TUi-000190-2y for importer@patchew.org; Mon, 26 Mar 2018 10:53:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEX-00038j-35 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEW-0004EX-3w for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47470 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEQ-00041J-HN; Mon, 26 Mar 2018 10:36:18 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A5CA4068056; Mon, 26 Mar 2018 14:36:18 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68FAE7C2D; Mon, 26 Mar 2018 14:36:17 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:55 +0200 Message-Id: <20180326143600.7724-15-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 26 Mar 2018 14:36:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 26 Mar 2018 14:36:18 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 14/19] parallels: Check maximum cluster size on 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, qemu-devel@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" It's unclear what the real maximum cluster size is for the Parallels format, but let's at least make sure that we don't get integer overflows in our .bdrv_co_create implementation. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/parallels.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index e2515dec81..799215e079 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -526,6 +526,11 @@ static int coroutine_fn parallels_co_create(BlockdevCr= eateOptions* opts, cl_size =3D DEFAULT_CLUSTER_SIZE; } =20 + /* XXX What is the real limit here? This is an insanely large maximum.= */ + if (cl_size >=3D INT64_MAX / MAX_PARALLELS_IMAGE_FACTOR) { + error_setg(errp, "Cluster size is too large"); + return -EINVAL; + } if (total_size >=3D MAX_PARALLELS_IMAGE_FACTOR * cl_size) { error_setg(errp, "Image size is too large for this cluster size"); return -E2BIG; --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075481602655.5638411410811; Mon, 26 Mar 2018 07:44:41 -0700 (PDT) Received: from localhost ([::1]:57106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TMT-000242-Jj for importer@patchew.org; Mon, 26 Mar 2018 10:44:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEb-0003BN-3R for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEW-0004ES-2N for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51578 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TER-00043W-Fc; Mon, 26 Mar 2018 10:36:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 088388182D1E; Mon, 26 Mar 2018 14:36:19 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55A617C2D; Mon, 26 Mar 2018 14:36:18 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:56 +0200 Message-Id: <20180326143600.7724-16-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 26 Mar 2018 14:36:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 26 Mar 2018 14:36:19 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 15/19] qemu-iotests: Test parallels image creation with QMP 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, qemu-devel@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" Signed-off-by: Kevin Wolf --- tests/qemu-iotests/212 | 326 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/212.out | 111 +++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 438 insertions(+) create mode 100755 tests/qemu-iotests/212 create mode 100644 tests/qemu-iotests/212.out diff --git a/tests/qemu-iotests/212 b/tests/qemu-iotests/212 new file mode 100755 index 0000000000..e5a1ba77ce --- /dev/null +++ b/tests/qemu-iotests/212 @@ -0,0 +1,326 @@ +#!/bin/bash +# +# Test parallels and file image creation +# +# 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=3Dkwolf@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # failure is the default! + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt parallels +_supported_proto file +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" + $QEMU -nographic -qmp stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \ + | _filter_qemu | _filter_imgfmt \ + | _filter_actual_image_size +} + +echo +echo "=3D=3D=3D Successful image creation (defaults) =3D=3D=3D" +echo + +size=3D$((128 * 1024 * 1024)) + +run_qemu < Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075316114725.9600521150937; Mon, 26 Mar 2018 07:41:56 -0700 (PDT) Received: from localhost ([::1]:57091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TJr-0007s1-8X for importer@patchew.org; Mon, 26 Mar 2018 10:41:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEb-0003BR-5k for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEX-0004Fw-I7 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46526 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TES-00045x-CG; Mon, 26 Mar 2018 10:36:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E902D4023141; Mon, 26 Mar 2018 14:36:19 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42E577C50; Mon, 26 Mar 2018 14:36:19 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:57 +0200 Message-Id: <20180326143600.7724-17-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 26 Mar 2018 14:36:19 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 16/19] vhdx: Require power-of-two block size on 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, qemu-devel@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" Images with a non-power-of-two block size are invalid and cannot be opened. Reject such block sizes when creating an image. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Jeff Cody --- block/vhdx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/vhdx.c b/block/vhdx.c index d2c54b7891..6a5e48eb69 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1877,6 +1877,10 @@ static int coroutine_fn vhdx_co_create(BlockdevCreat= eOptions *opts, error_setg_errno(errp, EINVAL, "Block size must be a multiple of 1= MB"); return -EINVAL; } + if (!is_power_of_2(block_size)) { + error_setg(errp, "Block size must be a power of two"); + return -EINVAL; + } if (block_size > VHDX_BLOCK_SIZE_MAX) { error_setg_errno(errp, EINVAL, "Block size must not exceed %d", VHDX_BLOCK_SIZE_MAX); --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15220762804311011.3728898514981; Mon, 26 Mar 2018 07:58:00 -0700 (PDT) Received: from localhost ([::1]:57190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TZL-0004sy-M0 for importer@patchew.org; Mon, 26 Mar 2018 10:57:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEb-0003BY-Pz for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEV-0004E6-SF for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47472 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TET-000480-97; Mon, 26 Mar 2018 10:36:21 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D68AD4040070; Mon, 26 Mar 2018 14:36:20 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30D217C50; Mon, 26 Mar 2018 14:36:20 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:58 +0200 Message-Id: <20180326143600.7724-18-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 26 Mar 2018 14:36:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 26 Mar 2018 14:36:20 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 17/19] vhdx: Don't use error_setg_errno() with constant errno 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, qemu-devel@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" error_setg_errno() is meant for cases where we got an errno from the OS that can add useful extra information to an error message. It's pointless if we pass a constant errno, these cases should use plain error_setg(). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Jeff Cody --- block/vhdx.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/block/vhdx.c b/block/vhdx.c index 6a5e48eb69..4a087d8708 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1822,7 +1822,7 @@ static int coroutine_fn vhdx_co_create(BlockdevCreate= Options *opts, /* Validate options and set default values */ image_size =3D vhdx_opts->size; if (image_size > VHDX_MAX_IMAGE_SIZE) { - error_setg_errno(errp, EINVAL, "Image size too large; max of 64TB"= ); + error_setg(errp, "Image size too large; max of 64TB"); return -EINVAL; } =20 @@ -1832,7 +1832,7 @@ static int coroutine_fn vhdx_co_create(BlockdevCreate= Options *opts, log_size =3D vhdx_opts->log_size; } if (log_size < MiB || (log_size % MiB) !=3D 0) { - error_setg_errno(errp, EINVAL, "Log size must be a multiple of 1 M= B"); + error_setg(errp, "Log size must be a multiple of 1 MB"); return -EINVAL; } =20 @@ -1874,7 +1874,7 @@ static int coroutine_fn vhdx_co_create(BlockdevCreate= Options *opts, } =20 if (block_size < MiB || (block_size % MiB) !=3D 0) { - error_setg_errno(errp, EINVAL, "Block size must be a multiple of 1= MB"); + error_setg(errp, "Block size must be a multiple of 1 MB"); return -EINVAL; } if (!is_power_of_2(block_size)) { @@ -1882,8 +1882,7 @@ static int coroutine_fn vhdx_co_create(BlockdevCreate= Options *opts, return -EINVAL; } if (block_size > VHDX_BLOCK_SIZE_MAX) { - error_setg_errno(errp, EINVAL, "Block size must not exceed %d", - VHDX_BLOCK_SIZE_MAX); + error_setg(errp, "Block size must not exceed %d", VHDX_BLOCK_SIZE_= MAX); return -EINVAL; } =20 --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522076200933874.4120826123054; Mon, 26 Mar 2018 07:56:40 -0700 (PDT) Received: from localhost ([::1]:57187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TY8-0004DB-4a for importer@patchew.org; Mon, 26 Mar 2018 10:56:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEb-0003BO-5x for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEX-0004Fp-E9 for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36862 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEV-0004D1-5X; Mon, 26 Mar 2018 10:36:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B684FEB700; Mon, 26 Mar 2018 14:36:22 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E3997C2D; Mon, 26 Mar 2018 14:36:20 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:35:59 +0200 Message-Id: <20180326143600.7724-19-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 26 Mar 2018 14:36:22 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 18/19] vhdx: Check for 4 GB maximum log size on creation 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, qemu-devel@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" It's unclear what the real maximum is, but we use an uint32_t to store the log size in vhdx_co_create(), so we should check that the given value fits in 32 bits. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Jeff Cody --- block/vhdx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/vhdx.c b/block/vhdx.c index 4a087d8708..6ac0424f61 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1829,6 +1829,10 @@ static int coroutine_fn vhdx_co_create(BlockdevCreat= eOptions *opts, if (!vhdx_opts->has_log_size) { log_size =3D DEFAULT_LOG_SIZE; } else { + if (vhdx_opts->log_size > UINT32_MAX) { + error_setg(errp, "Log size must be smaller than 4 GB"); + return -EINVAL; + } log_size =3D vhdx_opts->log_size; } if (log_size < MiB || (log_size % MiB) !=3D 0) { --=20 2.13.6 From nobody Sun Apr 28 06:58:18 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522075548992117.20142964625734; Mon, 26 Mar 2018 07:45:48 -0700 (PDT) Received: from localhost ([::1]:57117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TNc-0003L1-3t for importer@patchew.org; Mon, 26 Mar 2018 10:45:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TEn-0003NS-Bb for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TEj-0004Ny-4b for qemu-devel@nongnu.org; Mon, 26 Mar 2018 10:36:41 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51580 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0TEW-0004Dx-39; Mon, 26 Mar 2018 10:36:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A34EE8185352; Mon, 26 Mar 2018 14:36:23 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0B277C2D; Mon, 26 Mar 2018 14:36:22 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 26 Mar 2018 16:36:00 +0200 Message-Id: <20180326143600.7724-20-kwolf@redhat.com> In-Reply-To: <20180326143600.7724-1-kwolf@redhat.com> References: <20180326143600.7724-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 26 Mar 2018 14:36:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 26 Mar 2018 14:36:23 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 19/19] qemu-iotests: Test vhdx image creation with QMP 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, qemu-devel@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" Signed-off-by: Kevin Wolf --- tests/qemu-iotests/213 | 349 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/213.out | 121 ++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 471 insertions(+) create mode 100755 tests/qemu-iotests/213 create mode 100644 tests/qemu-iotests/213.out diff --git a/tests/qemu-iotests/213 b/tests/qemu-iotests/213 new file mode 100755 index 0000000000..3a00a0f6d6 --- /dev/null +++ b/tests/qemu-iotests/213 @@ -0,0 +1,349 @@ +#!/bin/bash +# +# Test vhdx and file image creation +# +# 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=3Dkwolf@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # failure is the default! + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt vhdx +_supported_proto file +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" + $QEMU -nographic -qmp stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \ + | _filter_qemu | _filter_imgfmt \ + | _filter_actual_image_size +} + +echo +echo "=3D=3D=3D Successful image creation (defaults) =3D=3D=3D" +echo + +size=3D$((128 * 1024 * 1024)) + +run_qemu <