From nobody Tue Feb 10 13:33:10 2026 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 1511189574886560.7318407259185; Mon, 20 Nov 2017 06:52:54 -0800 (PST) Received: from localhost ([::1]:57750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGnR2-0007EH-3p for importer@patchew.org; Mon, 20 Nov 2017 09:52:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGnP3-0005Xt-65 for qemu-devel@nongnu.org; Mon, 20 Nov 2017 09:50:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGnP2-00059e-9E for qemu-devel@nongnu.org; Mon, 20 Nov 2017 09:50:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48054) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eGnOz-00057p-Ay; Mon, 20 Nov 2017 09:50:25 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 70AC67AE99; Mon, 20 Nov 2017 14:50:24 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-185.ams2.redhat.com [10.36.116.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id DAF0A4F9EE; Mon, 20 Nov 2017 14:50:21 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Mon, 20 Nov 2017 15:50:05 +0100 Message-Id: <20171120145006.551-3-kwolf@redhat.com> In-Reply-To: <20171120145006.551-1-kwolf@redhat.com> References: <20171120145006.551-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 20 Nov 2017 14:50:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.11 2/3] block: Add errp to bdrv_all_goto_snapshot() 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, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org, jsnow@redhat.com 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: Vladimir Sementsov-Ogievskiy --- include/block/snapshot.h | 3 ++- block/snapshot.c | 11 ++++++----- migration/savevm.c | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/block/snapshot.h b/include/block/snapshot.h index aeb80405e8..9407799941 100644 --- a/include/block/snapshot.h +++ b/include/block/snapshot.h @@ -84,7 +84,8 @@ int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState= *bs, bool bdrv_all_can_snapshot(BlockDriverState **first_bad_bs); int bdrv_all_delete_snapshot(const char *name, BlockDriverState **first_bs= d_bs, Error **err); -int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bsd_= bs); +int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_= bs, + Error **errp); int bdrv_all_find_snapshot(const char *name, BlockDriverState **first_bad_= bs); int bdrv_all_create_snapshot(QEMUSnapshotInfo *sn, BlockDriverState *vm_state_bs, diff --git a/block/snapshot.c b/block/snapshot.c index 9c941e638d..13ec3b1c8c 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -467,9 +467,10 @@ fail: } =20 =20 -int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_= bs) +int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_= bs, + Error **errp) { - int err =3D 0; + int ret =3D 0; BlockDriverState *bs; BdrvNextIterator it; =20 @@ -478,10 +479,10 @@ int bdrv_all_goto_snapshot(const char *name, BlockDri= verState **first_bad_bs) =20 aio_context_acquire(ctx); if (bdrv_can_snapshot(bs)) { - err =3D bdrv_snapshot_goto(bs, name, NULL); + ret =3D bdrv_snapshot_goto(bs, name, errp); } aio_context_release(ctx); - if (err < 0) { + if (ret < 0) { bdrv_next_cleanup(&it); goto fail; } @@ -489,7 +490,7 @@ int bdrv_all_goto_snapshot(const char *name, BlockDrive= rState **first_bad_bs) =20 fail: *first_bad_bs =3D bs; - return err; + return ret; } =20 int bdrv_all_find_snapshot(const char *name, BlockDriverState **first_bad_= bs) diff --git a/migration/savevm.c b/migration/savevm.c index 4a88228614..192f2d82cd 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2346,10 +2346,10 @@ int load_snapshot(const char *name, Error **errp) /* Flush all IO requests so they don't interfere with the new state. = */ bdrv_drain_all_begin(); =20 - ret =3D bdrv_all_goto_snapshot(name, &bs); + ret =3D bdrv_all_goto_snapshot(name, &bs, errp); if (ret < 0) { - error_setg(errp, "Error %d while activating snapshot '%s' on '%s'", - ret, name, bdrv_get_device_name(bs)); + error_prepend(errp, "Could not load snapshot '%s' on '%s': ", + name, bdrv_get_device_name(bs)); goto err_drain; } =20 --=20 2.13.6