From nobody Tue Apr 30 08:53:47 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; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1574344810; cv=none; d=zoho.com; s=zohoarc; b=Rhpr3Oj2QVOF9IZOYj7lJUY0OIGDcEBAcV8wdr6fT70CkWvRL+ruK4bzy3GbP+3EBOpBIjBvtHnJvFEdfUyfpITB00t0ZT2P1GiGHTSNkwpHUE8Cx6SF/0fsGH5mMneA1kcZ/ImnSyO/rTmHCT1+AgVnyP5ToR7NWvdKXHrr6Ts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574344810; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NySVry+n3uW9jFbnujVIhfacnnp/b0B3jjKDpU72sjk=; b=ZdPWHja+EozJ/aPg4vjOvhj7GIXWJ/bH4LnOF6suRtQkrE+wjIfduTBekbFqb3Kga72ZUce4cVJr/VEiCv49Lgk3A+O23B/UHWQJEW5j1TEczqSVeGTQQ5/JAWdhUj6ljr4THeVciMozRAUjpsteQG0AB6f7p3P3SWLHTrf4p3g= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574344799389670.8637307435391; Thu, 21 Nov 2019 05:59:59 -0800 (PST) Received: from localhost ([::1]:40848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXn01-0003P6-Gl for importer@patchew.org; Thu, 21 Nov 2019 08:59:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35223) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXmyI-0001rb-U7 for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXmyH-0001Ej-Uw for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:10 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:54801 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXmyH-0001EL-RG for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-48-ypzfYVvZN62fksHklt5HxA-1; Thu, 21 Nov 2019 08:58:08 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1AD9C64A7E; Thu, 21 Nov 2019 13:58:07 +0000 (UTC) Received: from dritchie.redhat.com (unknown [10.33.36.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C9746CE76; Thu, 21 Nov 2019 13:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574344689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NySVry+n3uW9jFbnujVIhfacnnp/b0B3jjKDpU72sjk=; b=UpQzA3pEgjXFH8B/yK5hqbGCReLdS1vUMMnRNa3tz8oOiUATfH7ZfQqb1+WiI0Thyx4EVJ ZxmZKcgGWJUmGyW7YJlpJvFEloiXtypBoOjsOMxEeEP7luXB2GqRGB2Pd1gulywYZXjuJ7 9xI39s5xIGoNuLgxYYSfl6c3lx1B4X0= From: Sergio Lopez To: qemu-devel@nongnu.org Subject: [PATCH v4 1/5] blockdev: fix coding style issues in drive_backup_prepare Date: Thu, 21 Nov 2019 14:57:55 +0100 Message-Id: <20191121135759.101655-2-slp@redhat.com> In-Reply-To: <20191121135759.101655-1-slp@redhat.com> References: <20191121135759.101655-1-slp@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: ypzfYVvZN62fksHklt5HxA-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Sergio Lopez , Markus Armbruster , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Fix a couple of minor coding style issues in drive_backup_prepare. Signed-off-by: Sergio Lopez Reviewed-by: Max Reitz --- blockdev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index 8e029e9c01..553e315972 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3620,7 +3620,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup,= JobTxn *txn, =20 if (!backup->has_format) { backup->format =3D backup->mode =3D=3D NEW_IMAGE_MODE_EXISTING ? - NULL : (char*) bs->drv->format_name; + NULL : (char *) bs->drv->format_name; } =20 /* Early check to avoid creating target */ @@ -3630,8 +3630,10 @@ static BlockJob *do_drive_backup(DriveBackup *backup= , JobTxn *txn, =20 flags =3D bs->open_flags | BDRV_O_RDWR; =20 - /* See if we have a backing HD we can use to create our new image - * on top of. */ + /* + * See if we have a backing HD we can use to create our new image + * on top of. + */ if (backup->sync =3D=3D MIRROR_SYNC_MODE_TOP) { source =3D backing_bs(bs); if (!source) { --=20 2.23.0 From nobody Tue Apr 30 08:53:47 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; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1574344863; cv=none; d=zoho.com; s=zohoarc; b=KWu91rfOUpB0FzruL+ErHyy2bqPxxppr2v2GXG3aUM2/q/KOJ58OsseCSV9DlDJJvhEWXwypkDT0vRhqY7277UVXaCFjod+aCF4LtHO82/Gl7KmHpQq7CcnjNSELMI72miU6ILgDTT+tNDmkVc6+KGAq1nUrH1H0XwJteDahVwg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574344863; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VP5pEloe2SwYUxfhbFWqozdVGlE/7Oc6FBc0LOsq82Y=; b=aT/5vnCKmT3wS4Jd5h0UBRjoylTFpYNDLGQmcYRmYBlVapT4Vi9pZzk3s/7a1mprMcoGUPCbFVinY6JixB0Uw8lVq0SD4v6IHTGBcbhKA03QAjySuOu5RutpZtEf4zDGiPD2NpGkXalGmwgC9dcPbnj5orQYLINPmgsfB7kFt/4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574344863816534.3257896508042; Thu, 21 Nov 2019 06:01:03 -0800 (PST) Received: from localhost ([::1]:40850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXn01-0003PR-RC for importer@patchew.org; Thu, 21 Nov 2019 08:59:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35271) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXmyM-0001u1-A2 for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXmyK-0001HO-Io for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:14 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:40729 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXmyK-0001GU-FE for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:12 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-367-2VJwUPCSOya7xUa1ltMf5w-1; Thu, 21 Nov 2019 08:58:10 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15804107ACC7; Thu, 21 Nov 2019 13:58:09 +0000 (UTC) Received: from dritchie.redhat.com (unknown [10.33.36.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75AE46CE76; Thu, 21 Nov 2019 13:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574344691; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VP5pEloe2SwYUxfhbFWqozdVGlE/7Oc6FBc0LOsq82Y=; b=fT+AHLAS2Ez7RAN1eWbZ34dJp1s5pd/loXi0OCpjO5thFI/WCy2H9g/jY/u9yqCNOw0SvA uiZh5IQZSWeTKqpFwQrOlle5Rk3dPpL7fqvY5jHYd44suoasN21pJb/uGlkuizlmnqLecS snfTce/BHOgMGOp+Pl8MTsb+v847s4I= From: Sergio Lopez To: qemu-devel@nongnu.org Subject: [PATCH v4 2/5] blockdev: unify qmp_drive_backup and drive-backup transaction paths Date: Thu, 21 Nov 2019 14:57:56 +0100 Message-Id: <20191121135759.101655-3-slp@redhat.com> In-Reply-To: <20191121135759.101655-1-slp@redhat.com> References: <20191121135759.101655-1-slp@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 2VJwUPCSOya7xUa1ltMf5w-1 X-Mimecast-Spam-Score: 0 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: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Sergio Lopez , Markus Armbruster , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Issuing a drive-backup from qmp_drive_backup takes a slightly different path than when it's issued from a transaction. In the code, this is manifested as some redundancy between do_drive_backup() and drive_backup_prepare(). This change unifies both paths, merging do_drive_backup() and drive_backup_prepare(), and changing qmp_drive_backup() to create a transaction instead of calling do_backup_common() direcly. As a side-effect, now qmp_drive_backup() is executed inside a drained section, as it happens when creating a drive-backup transaction. This change is visible from the user's perspective, as the job gets paused and immediately resumed before starting the actual work. Signed-off-by: Sergio Lopez --- blockdev.c | 224 ++++++++++++++++++++++++----------------------------- 1 file changed, 100 insertions(+), 124 deletions(-) diff --git a/blockdev.c b/blockdev.c index 553e315972..5e85fc042e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1761,39 +1761,128 @@ typedef struct DriveBackupState { BlockJob *job; } DriveBackupState; =20 -static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn, - Error **errp); +static BlockJob *do_backup_common(BackupCommon *backup, + BlockDriverState *bs, + BlockDriverState *target_bs, + AioContext *aio_context, + JobTxn *txn, Error **errp); =20 static void drive_backup_prepare(BlkActionState *common, Error **errp) { DriveBackupState *state =3D DO_UPCAST(DriveBackupState, common, common= ); - BlockDriverState *bs; DriveBackup *backup; + BlockDriverState *bs; + BlockDriverState *target_bs; + BlockDriverState *source =3D NULL; AioContext *aio_context; + QDict *options; Error *local_err =3D NULL; + int flags; + int64_t size; + bool set_backing_hd =3D false; =20 assert(common->action->type =3D=3D TRANSACTION_ACTION_KIND_DRIVE_BACKU= P); backup =3D common->action->u.drive_backup.data; =20 + if (!backup->has_mode) { + backup->mode =3D NEW_IMAGE_MODE_ABSOLUTE_PATHS; + } + bs =3D bdrv_lookup_bs(backup->device, backup->device, errp); if (!bs) { return; } =20 + if (!bs->drv) { + error_setg(errp, "Device has no medium"); + return; + } + aio_context =3D bdrv_get_aio_context(bs); aio_context_acquire(aio_context); =20 /* Paired with .clean() */ bdrv_drained_begin(bs); =20 - state->bs =3D bs; + if (!backup->has_format) { + backup->format =3D backup->mode =3D=3D NEW_IMAGE_MODE_EXISTING ? + NULL : (char *) bs->drv->format_name; + } + + /* Early check to avoid creating target */ + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) { + goto out; + } + + flags =3D bs->open_flags | BDRV_O_RDWR; + + /* + * See if we have a backing HD we can use to create our new image + * on top of. + */ + if (backup->sync =3D=3D MIRROR_SYNC_MODE_TOP) { + source =3D backing_bs(bs); + if (!source) { + backup->sync =3D MIRROR_SYNC_MODE_FULL; + } + } + if (backup->sync =3D=3D MIRROR_SYNC_MODE_NONE) { + source =3D bs; + flags |=3D BDRV_O_NO_BACKING; + set_backing_hd =3D true; + } + + size =3D bdrv_getlength(bs); + if (size < 0) { + error_setg_errno(errp, -size, "bdrv_getlength failed"); + goto out; + } + + if (backup->mode !=3D NEW_IMAGE_MODE_EXISTING) { + assert(backup->format); + if (source) { + bdrv_refresh_filename(source); + bdrv_img_create(backup->target, backup->format, source->filena= me, + source->drv->format_name, NULL, + size, flags, false, &local_err); + } else { + bdrv_img_create(backup->target, backup->format, NULL, NULL, NU= LL, + size, flags, false, &local_err); + } + } =20 - state->job =3D do_drive_backup(backup, common->block_job_txn, &local_e= rr); if (local_err) { error_propagate(errp, local_err); goto out; } =20 + options =3D qdict_new(); + qdict_put_str(options, "discard", "unmap"); + qdict_put_str(options, "detect-zeroes", "unmap"); + if (backup->format) { + qdict_put_str(options, "driver", backup->format); + } + + target_bs =3D bdrv_open(backup->target, NULL, options, flags, errp); + if (!target_bs) { + goto out; + } + + if (set_backing_hd) { + bdrv_set_backing_hd(target_bs, source, &local_err); + if (local_err) { + goto unref; + } + } + + state->bs =3D bs; + + state->job =3D do_backup_common(qapi_DriveBackup_base(backup), + bs, target_bs, aio_context, + common->block_job_txn, errp); + +unref: + bdrv_unref(target_bs); out: aio_context_release(aio_context); } @@ -3587,126 +3676,13 @@ static BlockJob *do_backup_common(BackupCommon *ba= ckup, return job; } =20 -static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn, - Error **errp) -{ - BlockDriverState *bs; - BlockDriverState *target_bs; - BlockDriverState *source =3D NULL; - BlockJob *job =3D NULL; - AioContext *aio_context; - QDict *options; - Error *local_err =3D NULL; - int flags; - int64_t size; - bool set_backing_hd =3D false; - - if (!backup->has_mode) { - backup->mode =3D NEW_IMAGE_MODE_ABSOLUTE_PATHS; - } - - bs =3D bdrv_lookup_bs(backup->device, backup->device, errp); - if (!bs) { - return NULL; - } - - if (!bs->drv) { - error_setg(errp, "Device has no medium"); - return NULL; - } - - aio_context =3D bdrv_get_aio_context(bs); - aio_context_acquire(aio_context); - - if (!backup->has_format) { - backup->format =3D backup->mode =3D=3D NEW_IMAGE_MODE_EXISTING ? - NULL : (char *) bs->drv->format_name; - } - - /* Early check to avoid creating target */ - if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) { - goto out; - } - - flags =3D bs->open_flags | BDRV_O_RDWR; - - /* - * See if we have a backing HD we can use to create our new image - * on top of. - */ - if (backup->sync =3D=3D MIRROR_SYNC_MODE_TOP) { - source =3D backing_bs(bs); - if (!source) { - backup->sync =3D MIRROR_SYNC_MODE_FULL; - } - } - if (backup->sync =3D=3D MIRROR_SYNC_MODE_NONE) { - source =3D bs; - flags |=3D BDRV_O_NO_BACKING; - set_backing_hd =3D true; - } - - size =3D bdrv_getlength(bs); - if (size < 0) { - error_setg_errno(errp, -size, "bdrv_getlength failed"); - goto out; - } - - if (backup->mode !=3D NEW_IMAGE_MODE_EXISTING) { - assert(backup->format); - if (source) { - bdrv_refresh_filename(source); - bdrv_img_create(backup->target, backup->format, source->filena= me, - source->drv->format_name, NULL, - size, flags, false, &local_err); - } else { - bdrv_img_create(backup->target, backup->format, NULL, NULL, NU= LL, - size, flags, false, &local_err); - } - } - - if (local_err) { - error_propagate(errp, local_err); - goto out; - } - - options =3D qdict_new(); - qdict_put_str(options, "discard", "unmap"); - qdict_put_str(options, "detect-zeroes", "unmap"); - if (backup->format) { - qdict_put_str(options, "driver", backup->format); - } - - target_bs =3D bdrv_open(backup->target, NULL, options, flags, errp); - if (!target_bs) { - goto out; - } - - if (set_backing_hd) { - bdrv_set_backing_hd(target_bs, source, &local_err); - if (local_err) { - goto unref; - } - } - - job =3D do_backup_common(qapi_DriveBackup_base(backup), - bs, target_bs, aio_context, txn, errp); - -unref: - bdrv_unref(target_bs); -out: - aio_context_release(aio_context); - return job; -} - -void qmp_drive_backup(DriveBackup *arg, Error **errp) +void qmp_drive_backup(DriveBackup *backup, Error **errp) { - - BlockJob *job; - job =3D do_drive_backup(arg, NULL, errp); - if (job) { - job_start(&job->job); - } + TransactionAction action =3D { + .type =3D TRANSACTION_ACTION_KIND_DRIVE_BACKUP, + .u.drive_backup.data =3D backup, + }; + blockdev_do_action(&action, errp); } =20 BlockDeviceInfoList *qmp_query_named_block_nodes(Error **errp) --=20 2.23.0 From nobody Tue Apr 30 08:53:47 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; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1574345078; cv=none; d=zoho.com; s=zohoarc; b=E5t1xOZCHjl5ulmgUMlPbDjU9BUHZv5wZOcim2/OR+vgK5BZd7ax9lSKX5Yoc+y3NZK1ZGHWX9pGxwGGNKnudYIVU3lyrp7YLM6HfLYJ32Yn+VVlALPTXpSYg8ngD95fAoI28LFou1COVIwh4jyDbs9hQ/GDxJz7ujYjuk1XDr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574345078; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Kq/9wJkDWz32+flqmwF3HTN/ssqhgeSHnabqlnRZgAk=; b=kw/29l/0xAhNeQAlf2XgTO94jzwMMBk74+bERj35HcEYe5C3RMTW14l7rmUJmpkEyb4cWGilweDMaWIVmqnuYNZz1zX8m5X+j7R3OOmr7nbIX9T6EY0XWvDqDOTY0X7sfCGITq3L+MZ9FNvg6Op3w8cULndz+a2b+l7WNLXJM/Q= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574345078156768.7311124916729; Thu, 21 Nov 2019 06:04:38 -0800 (PST) Received: from localhost ([::1]:40932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXn4T-0007TC-JP for importer@patchew.org; Thu, 21 Nov 2019 09:04:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35302) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXmyO-0001yB-W5 for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXmyN-0001KB-Jg for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:16 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50221 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXmyN-0001Jg-G9 for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:15 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-7hLVfRKgNPufNbXc5BZNvQ-1; Thu, 21 Nov 2019 08:58:12 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E7531852E2D; Thu, 21 Nov 2019 13:58:11 +0000 (UTC) Received: from dritchie.redhat.com (unknown [10.33.36.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F9636E70D; Thu, 21 Nov 2019 13:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574344695; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kq/9wJkDWz32+flqmwF3HTN/ssqhgeSHnabqlnRZgAk=; b=QfgibSCUg3n2vcPG/6bW5leriIBRMF0nORgjmXO8P6P9ESKNDFcxPt7aXD3oHOQYtlrENr zVIZsamY82E2442cRE9Lbe/uuNOfuTOr7koOv/LaetSjrgwWBlBvLI7p02QAfT2oI3OrcD u8/aGBvxTs/Gp0J0zRQhRHFmFbqLnvo= From: Sergio Lopez To: qemu-devel@nongnu.org Subject: [PATCH v4 3/5] blockdev: unify qmp_blockdev_backup and blockdev-backup transaction paths Date: Thu, 21 Nov 2019 14:57:57 +0100 Message-Id: <20191121135759.101655-4-slp@redhat.com> In-Reply-To: <20191121135759.101655-1-slp@redhat.com> References: <20191121135759.101655-1-slp@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 7hLVfRKgNPufNbXc5BZNvQ-1 X-Mimecast-Spam-Score: 0 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: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Sergio Lopez , Markus Armbruster , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Issuing a blockdev-backup from qmp_blockdev_backup takes a slightly different path than when it's issued from a transaction. In the code, this is manifested as some redundancy between do_blockdev_backup() and blockdev_backup_prepare(). This change unifies both paths, merging do_blockdev_backup() and blockdev_backup_prepare(), and changing qmp_blockdev_backup() to create a transaction instead of calling do_backup_common() direcly. As a side-effect, now qmp_blockdev_backup() is executed inside a drained section, as it happens when creating a blockdev-backup transaction. This change is visible from the user's perspective, as the job gets paused and immediately resumed before starting the actual work. Signed-off-by: Sergio Lopez Reviewed-by: Max Reitz --- blockdev.c | 60 ++++++++++++------------------------------------------ 1 file changed, 13 insertions(+), 47 deletions(-) diff --git a/blockdev.c b/blockdev.c index 5e85fc042e..152a0f7454 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1940,16 +1940,13 @@ typedef struct BlockdevBackupState { BlockJob *job; } BlockdevBackupState; =20 -static BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn, - Error **errp); - static void blockdev_backup_prepare(BlkActionState *common, Error **errp) { BlockdevBackupState *state =3D DO_UPCAST(BlockdevBackupState, common, = common); BlockdevBackup *backup; - BlockDriverState *bs, *target; + BlockDriverState *bs; + BlockDriverState *target_bs; AioContext *aio_context; - Error *local_err =3D NULL; =20 assert(common->action->type =3D=3D TRANSACTION_ACTION_KIND_BLOCKDEV_BA= CKUP); backup =3D common->action->u.blockdev_backup.data; @@ -1959,8 +1956,8 @@ static void blockdev_backup_prepare(BlkActionState *c= ommon, Error **errp) return; } =20 - target =3D bdrv_lookup_bs(backup->target, backup->target, errp); - if (!target) { + target_bs =3D bdrv_lookup_bs(backup->target, backup->target, errp); + if (!target_bs) { return; } =20 @@ -1971,13 +1968,10 @@ static void blockdev_backup_prepare(BlkActionState = *common, Error **errp) /* Paired with .clean() */ bdrv_drained_begin(state->bs); =20 - state->job =3D do_blockdev_backup(backup, common->block_job_txn, &loca= l_err); - if (local_err) { - error_propagate(errp, local_err); - goto out; - } + state->job =3D do_backup_common(qapi_BlockdevBackup_base(backup), + bs, target_bs, aio_context, + common->block_job_txn, errp); =20 -out: aio_context_release(aio_context); } =20 @@ -3695,41 +3689,13 @@ XDbgBlockGraph *qmp_x_debug_query_block_graph(Error= **errp) return bdrv_get_xdbg_block_graph(errp); } =20 -BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn, - Error **errp) +void qmp_blockdev_backup(BlockdevBackup *backup, Error **errp) { - BlockDriverState *bs; - BlockDriverState *target_bs; - AioContext *aio_context; - BlockJob *job; - - bs =3D bdrv_lookup_bs(backup->device, backup->device, errp); - if (!bs) { - return NULL; - } - - target_bs =3D bdrv_lookup_bs(backup->target, backup->target, errp); - if (!target_bs) { - return NULL; - } - - aio_context =3D bdrv_get_aio_context(bs); - aio_context_acquire(aio_context); - - job =3D do_backup_common(qapi_BlockdevBackup_base(backup), - bs, target_bs, aio_context, txn, errp); - - aio_context_release(aio_context); - return job; -} - -void qmp_blockdev_backup(BlockdevBackup *arg, Error **errp) -{ - BlockJob *job; - job =3D do_blockdev_backup(arg, NULL, errp); - if (job) { - job_start(&job->job); - } + TransactionAction action =3D { + .type =3D TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP, + .u.blockdev_backup.data =3D backup, + }; + blockdev_do_action(&action, errp); } =20 /* Parameter check and block job starting for drive mirroring. --=20 2.23.0 From nobody Tue Apr 30 08:53:47 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; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1574345218; cv=none; d=zoho.com; s=zohoarc; b=Dh4bcGPLE4dV4QUYySy70R+KuX47H53FcmhJAfEffSlvtSqsv7LLppBq46lK/XHYEcUyjUD5YEu/3S8UN9TYiEhmrF/o/v1/rcdqorw6OGXEYvK52oy6/vISc5zK0RzTh3iaJvICZT4sLq7q7y0UowOwC0XF1msswNgMPr/9/qs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574345218; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uP29D3i3Jo/HrZeAJm59V6dRbMwu73JzUIZJLFx40Vw=; b=geWM49E+ZwWXWRuuK/5upgC/sXO7yWKiklcfQTHnLTPV92IGM91HSJCF3E/uXpNd8SHzOShdLuiP6V6cFAWSgZo9W0G9sEaJfNp5+k11M3tGq4QbXYL3aD4zQh80MGEq0A/2EEnny5DP5oSrmiJyOCk4VM5+m2UVIHs1/qyfef8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574345218079624.9014547001865; Thu, 21 Nov 2019 06:06:58 -0800 (PST) Received: from localhost ([::1]:41004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXn6l-0001eQ-B4 for importer@patchew.org; Thu, 21 Nov 2019 09:06:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35309) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXmyP-0001zK-EZ for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXmyN-0001KY-OP for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:17 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:42017 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXmyN-0001Je-JU for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:15 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-327-dwfdLpFJOl2SDg7AflTFHQ-1; Thu, 21 Nov 2019 08:58:14 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03DCC801E58; Thu, 21 Nov 2019 13:58:13 +0000 (UTC) Received: from dritchie.redhat.com (unknown [10.33.36.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 673856CE76; Thu, 21 Nov 2019 13:58:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574344695; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uP29D3i3Jo/HrZeAJm59V6dRbMwu73JzUIZJLFx40Vw=; b=GHdHeAhBsUI059gP4XRSN5tFqFxzg2kBD0mwcBPBZyJ0Gfbhlv9LO7NT1WonkpvxQ4Vk8y eLoqSX1eOGLoR1Kq4riLd9EM4gaJFbadLY8IZpvujE2pBPH9TlDz5XrU8B9vUccZ9umbIY lqIFM0t7g3nllBun8BC9afD4FwMSgCo= From: Sergio Lopez To: qemu-devel@nongnu.org Subject: [PATCH v4 4/5] blockdev: honor bdrv_try_set_aio_context() context requirements Date: Thu, 21 Nov 2019 14:57:58 +0100 Message-Id: <20191121135759.101655-5-slp@redhat.com> In-Reply-To: <20191121135759.101655-1-slp@redhat.com> References: <20191121135759.101655-1-slp@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: dwfdLpFJOl2SDg7AflTFHQ-1 X-Mimecast-Spam-Score: 0 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: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Sergio Lopez , Markus Armbruster , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" bdrv_try_set_aio_context() requires that the old context is held, and the new context is not held. Fix all the occurrences where it's not done this way. Suggested-by: Max Reitz Signed-off-by: Sergio Lopez --- blockdev.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/blockdev.c b/blockdev.c index 152a0f7454..b0647d8d33 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1535,6 +1535,7 @@ static void external_snapshot_prepare(BlkActionState = *common, DO_UPCAST(ExternalSnapshotState, common, comm= on); TransactionAction *action =3D common->action; AioContext *aio_context; + AioContext *old_context; int ret; =20 /* 'blockdev-snapshot' and 'blockdev-snapshot-sync' have similar @@ -1675,11 +1676,20 @@ static void external_snapshot_prepare(BlkActionStat= e *common, goto out; } =20 + /* Honor bdrv_try_set_aio_context() context acquisition requirements. = */ + old_context =3D bdrv_get_aio_context(state->new_bs); + aio_context_release(aio_context); + aio_context_acquire(old_context); + ret =3D bdrv_try_set_aio_context(state->new_bs, aio_context, errp); if (ret < 0) { - goto out; + aio_context_release(old_context); + return; } =20 + aio_context_release(old_context); + aio_context_acquire(aio_context); + /* This removes our old bs and adds the new bs. This is an operation t= hat * can fail, so we need to do it in .prepare; undoing it for abort is * always possible. */ @@ -1775,11 +1785,13 @@ static void drive_backup_prepare(BlkActionState *co= mmon, Error **errp) BlockDriverState *target_bs; BlockDriverState *source =3D NULL; AioContext *aio_context; + AioContext *old_context; QDict *options; Error *local_err =3D NULL; int flags; int64_t size; bool set_backing_hd =3D false; + int ret; =20 assert(common->action->type =3D=3D TRANSACTION_ACTION_KIND_DRIVE_BACKU= P); backup =3D common->action->u.drive_backup.data; @@ -1868,6 +1880,20 @@ static void drive_backup_prepare(BlkActionState *com= mon, Error **errp) goto out; } =20 + /* Honor bdrv_try_set_aio_context() context acquisition requirements. = */ + old_context =3D bdrv_get_aio_context(target_bs); + aio_context_release(aio_context); + aio_context_acquire(old_context); + + ret =3D bdrv_try_set_aio_context(target_bs, aio_context, errp); + if (ret < 0) { + aio_context_release(old_context); + return; + } + + aio_context_release(old_context); + aio_context_acquire(aio_context); + if (set_backing_hd) { bdrv_set_backing_hd(target_bs, source, &local_err); if (local_err) { @@ -1947,6 +1973,8 @@ static void blockdev_backup_prepare(BlkActionState *c= ommon, Error **errp) BlockDriverState *bs; BlockDriverState *target_bs; AioContext *aio_context; + AioContext *old_context; + int ret; =20 assert(common->action->type =3D=3D TRANSACTION_ACTION_KIND_BLOCKDEV_BA= CKUP); backup =3D common->action->u.blockdev_backup.data; @@ -1961,7 +1989,18 @@ static void blockdev_backup_prepare(BlkActionState *= common, Error **errp) return; } =20 + /* Honor bdrv_try_set_aio_context() context acquisition requirements. = */ aio_context =3D bdrv_get_aio_context(bs); + old_context =3D bdrv_get_aio_context(target_bs); + aio_context_acquire(old_context); + + ret =3D bdrv_try_set_aio_context(target_bs, aio_context, errp); + if (ret < 0) { + aio_context_release(old_context); + return; + } + + aio_context_release(old_context); aio_context_acquire(aio_context); state->bs =3D bs; =20 @@ -3562,7 +3601,6 @@ static BlockJob *do_backup_common(BackupCommon *backu= p, BlockJob *job =3D NULL; BdrvDirtyBitmap *bmap =3D NULL; int job_flags =3D JOB_DEFAULT; - int ret; =20 if (!backup->has_speed) { backup->speed =3D 0; @@ -3586,11 +3624,6 @@ static BlockJob *do_backup_common(BackupCommon *back= up, backup->compress =3D false; } =20 - ret =3D bdrv_try_set_aio_context(target_bs, aio_context, errp); - if (ret < 0) { - return NULL; - } - if ((backup->sync =3D=3D MIRROR_SYNC_MODE_BITMAP) || (backup->sync =3D=3D MIRROR_SYNC_MODE_INCREMENTAL)) { /* done before desugaring 'incremental' to print the right message= */ @@ -3825,6 +3858,7 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp) BlockDriverState *bs; BlockDriverState *source, *target_bs; AioContext *aio_context; + AioContext *old_context; BlockMirrorBackingMode backing_mode; Error *local_err =3D NULL; QDict *options =3D NULL; @@ -3937,12 +3971,22 @@ void qmp_drive_mirror(DriveMirror *arg, Error **err= p) (arg->mode =3D=3D NEW_IMAGE_MODE_EXISTING || !bdrv_has_zero_init(target_bs))); =20 + + /* Honor bdrv_try_set_aio_context() context acquisition requirements. = */ + old_context =3D bdrv_get_aio_context(target_bs); + aio_context_release(aio_context); + aio_context_acquire(old_context); + ret =3D bdrv_try_set_aio_context(target_bs, aio_context, errp); if (ret < 0) { bdrv_unref(target_bs); - goto out; + aio_context_release(old_context); + return; } =20 + aio_context_release(old_context); + aio_context_acquire(aio_context); + blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, targe= t_bs, arg->has_replaces, arg->replaces, arg->sync, backing_mode, zero_target, @@ -3984,6 +4028,7 @@ void qmp_blockdev_mirror(bool has_job_id, const char = *job_id, BlockDriverState *bs; BlockDriverState *target_bs; AioContext *aio_context; + AioContext *old_context; BlockMirrorBackingMode backing_mode =3D MIRROR_LEAVE_BACKING_CHAIN; Error *local_err =3D NULL; bool zero_target; @@ -4001,14 +4046,18 @@ void qmp_blockdev_mirror(bool has_job_id, const cha= r *job_id, =20 zero_target =3D (sync =3D=3D MIRROR_SYNC_MODE_FULL); =20 + /* Honor bdrv_try_set_aio_context() context acquisition requirements. = */ + old_context =3D bdrv_get_aio_context(target_bs); aio_context =3D bdrv_get_aio_context(bs); - aio_context_acquire(aio_context); + aio_context_acquire(old_context); =20 ret =3D bdrv_try_set_aio_context(target_bs, aio_context, errp); if (ret < 0) { goto out; } =20 + aio_context_acquire(aio_context); + blockdev_mirror_common(has_job_id ? job_id : NULL, bs, target_bs, has_replaces, replaces, sync, backing_mode, zero_target, has_speed, speed, --=20 2.23.0 From nobody Tue Apr 30 08:53:47 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; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1574344997; cv=none; d=zoho.com; s=zohoarc; b=cBJAKxf7hg7RuUKXPBIZma4CHmT98PIBg0g/LI5fYte36ii2AvCr5tKriZZermazd4vy2l9+hVfLCR/TtnRDR5ncDYkPxiK2YhsG19IBJWJkyO+SY/QIrkiuC6DXl4Sb19JTrd/qJ6qV5sgEhlV/eO6kqgJje1lJCWHqIcnHVKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574344997; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2NO3Y+YgqZ7oFYwXVncrtROSpQ6dChJQOlWLkeEdQDQ=; b=ikl7OefTvUOTP30js/sNdxjGp+Q94AXyWtNi8K1bJtMmBYI0EfTmZL5gLBGcTRxHV0LIUeNd8EWsPzgbelvB7wEQuFu+hrXZcurWM6hi1Gx+0d3i3sXCJ6n9ALDKxDFTvh9zN7KHmOzj7Jvmgy6v1ZA/2Twbtj2huD0lklUjIcE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574344997416586.3182018248851; Thu, 21 Nov 2019 06:03:17 -0800 (PST) Received: from localhost ([::1]:40926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXn3D-0006Lw-SF for importer@patchew.org; Thu, 21 Nov 2019 09:03:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35336) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXmyS-00022l-4Q for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXmyP-0001Ns-OB for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:18 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:44078 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXmyP-0001Ms-K0 for qemu-devel@nongnu.org; Thu, 21 Nov 2019 08:58:17 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-398-3TiI-n2EP4GLS_86DMQ8Rw-1; Thu, 21 Nov 2019 08:58:15 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F08AA64A7E; Thu, 21 Nov 2019 13:58:14 +0000 (UTC) Received: from dritchie.redhat.com (unknown [10.33.36.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F8DA6E70E; Thu, 21 Nov 2019 13:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574344697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2NO3Y+YgqZ7oFYwXVncrtROSpQ6dChJQOlWLkeEdQDQ=; b=jEKQNSrn8Ad5tOOdYmnXPOtUfcJmlLk3AWAKhwZNIFueS5j0OuSXUINFFrYwDU+54UGf+G ZBDk/GtQ/P59cOUoKBST6BcK6aOwCG35BE96od4rUSfyRMxTVty2RnrAj4BrsP3ydn/vZF SGeVAACazoFCSFMq8YPq3EsySVigf2s= From: Sergio Lopez To: qemu-devel@nongnu.org Subject: [PATCH v4 5/5] iotests: fix 141 after qmp_drive_backup with transactions Date: Thu, 21 Nov 2019 14:57:59 +0100 Message-Id: <20191121135759.101655-6-slp@redhat.com> In-Reply-To: <20191121135759.101655-1-slp@redhat.com> References: <20191121135759.101655-1-slp@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 3TiI-n2EP4GLS_86DMQ8Rw-1 X-Mimecast-Spam-Score: 0 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: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Sergio Lopez , Markus Armbruster , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" qmp_drive_backup now creates and starts a transactions, which implies that the job will transition to pause and running twice. Fix test 141 to be aware of this change. Signed-off-by: Sergio Lopez --- tests/qemu-iotests/141.out | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/141.out b/tests/qemu-iotests/141.out index 3645675ce8..263b680bdf 100644 --- a/tests/qemu-iotests/141.out +++ b/tests/qemu-iotests/141.out @@ -13,6 +13,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D10485= 76 backing_file=3DTEST_DIR/m. Formatting 'TEST_DIR/o.IMGFMT', fmt=3DIMGFMT size=3D1048576 backing_file= =3DTEST_DIR/t.IMGFMT backing_fmt=3DIMGFMT {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "job0"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} {'execute': 'blockdev-del', 'arguments': {'node-name': 'drv0'}} {"error": {"class": "GenericError", "desc": "Node 'drv0' is busy: node is = used as backing hd of 'NODE_NAME'"}} {'execute': 'block-job-cancel', 'arguments': {'device': 'job0'}} --=20 2.23.0