From nobody Mon Feb 9 05:40:40 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 1506520785813575.3361737156142; Wed, 27 Sep 2017 06:59:45 -0700 (PDT) Received: from localhost ([::1]:54967 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxCsD-000271-K3 for importer@patchew.org; Wed, 27 Sep 2017 09:59:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39624) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxCqX-0000zc-TG for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:57:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxCqW-0002RH-So for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:57:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47274) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxCqW-0002Pl-Js for qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:57:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89C2885540; Wed, 27 Sep 2017 13:57:51 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-116-234.ams2.redhat.com [10.36.116.234]) by smtp.corp.redhat.com (Postfix) with ESMTP id A474585A5E; Wed, 27 Sep 2017 13:57:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 89C2885540 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 27 Sep 2017 14:57:38 +0100 Message-Id: <20170927135742.19724-4-dgilbert@redhat.com> In-Reply-To: <20170927135742.19724-1-dgilbert@redhat.com> References: <20170927135742.19724-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 27 Sep 2017 13:57:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/7] migration: check pre_save return in vmstate_save_state 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: pl@kamp.de, quintela@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" From: "Dr. David Alan Gilbert" Check the return value of pre_save state and fail vmstate_save_state if the pre_save failed. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20170925112917.21340-3-dgilbert@redhat.com> Reviewed-by: Peter Xu Reviewed-by: Cornelia Huck Reviewed-by: Juan Quintela Signed-off-by: Dr. David Alan Gilbert --- include/migration/vmstate.h | 4 ++-- migration/trace-events | 1 + migration/vmstate.c | 12 ++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index da46b1a36d..88b55df5ae 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -994,8 +994,8 @@ extern const VMStateInfo vmstate_info_qtailq; =20 int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, int version_id); -void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, - void *opaque, QJSON *vmdesc); +int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, + void *opaque, QJSON *vmdesc); =20 bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque); =20 diff --git a/migration/trace-events b/migration/trace-events index d2910a6e7b..6f29fcc686 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -40,6 +40,7 @@ savevm_state_iterate(void) "" savevm_state_cleanup(void) "" savevm_state_complete_precopy(void) "" vmstate_save(const char *idstr, const char *vmsd_name) "%s, %s" +vmstate_save_state_pre_save_res(const char *name, int res) "%s/%d" vmstate_save_state_loop(const char *name, const char *field, int n_elems) = "%s/%s[%d]" vmstate_save_state_top(const char *idstr) "%s" vmstate_subsection_save_loop(const char *name, const char *sub) "%s/%s" diff --git a/migration/vmstate.c b/migration/vmstate.c index 3226e8eb45..ae8abd3c32 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -308,15 +308,21 @@ bool vmstate_save_needed(const VMStateDescription *vm= sd, void *opaque) } =20 =20 -void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, +int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, QJSON *vmdesc) { + int ret =3D 0; VMStateField *field =3D vmsd->fields; =20 trace_vmstate_save_state_top(vmsd->name); =20 if (vmsd->pre_save) { - vmsd->pre_save(opaque); + ret =3D vmsd->pre_save(opaque); + trace_vmstate_save_state_pre_save_res(vmsd->name, ret); + if (ret) { + error_report("pre-save failed: %s", vmsd->name); + return ret; + } } =20 if (vmdesc) { @@ -381,6 +387,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescr= iption *vmsd, } =20 vmstate_subsection_save(f, vmsd, opaque, vmdesc); + + return 0; } =20 static const VMStateDescription * --=20 2.13.5