Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/815766/?format=api
{ "id": 815766, "url": "http://patchwork.ozlabs.org/api/patches/815766/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170919180038.26056-6-dgilbert@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170919180038.26056-6-dgilbert@redhat.com>", "list_archive_url": null, "date": "2017-09-19T18:00:38", "name": "[5/5] migration: Route more error paths", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "98d95e7df3b2ca97e733a67442200e0d238dd255", "submitter": { "id": 48102, "url": "http://patchwork.ozlabs.org/api/people/48102/?format=api", "name": "Dr. David Alan Gilbert", "email": "dgilbert@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170919180038.26056-6-dgilbert@redhat.com/mbox/", "series": [ { "id": 3942, "url": "http://patchwork.ozlabs.org/api/series/3942/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3942", "date": "2017-09-19T18:00:35", "name": "migration: let pre_save fail", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3942/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/815766/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/815766/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=dgilbert@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xxW5Q6JV6z9s7c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 04:06:02 +1000 (AEST)", "from localhost ([::1]:44667 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1duMuG-0001GB-U5\n\tfor incoming@patchwork.ozlabs.org; Tue, 19 Sep 2017 14:06:00 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:37018)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <dgilbert@redhat.com>) id 1duMpS-0005vw-TG\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 14:01:09 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <dgilbert@redhat.com>) id 1duMpR-0000C4-LX\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 14:01:03 -0400", "from mx1.redhat.com ([209.132.183.28]:54736)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <dgilbert@redhat.com>) id 1duMpR-00009Y-Cl\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 14:01:01 -0400", "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 5C74C7E431;\n\tTue, 19 Sep 2017 18:01:00 +0000 (UTC)", "from dgilbert-t530.redhat.com (ovpn-117-120.ams2.redhat.com\n\t[10.36.117.120])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 0CDB45D97C;\n\tTue, 19 Sep 2017 18:00:58 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 5C74C7E431", "From": "\"Dr. David Alan Gilbert (git)\" <dgilbert@redhat.com>", "To": "qemu-devel@nongnu.org,\n\tquintela@redhat.com,\n\tpeterx@redhat.com", "Date": "Tue, 19 Sep 2017 19:00:38 +0100", "Message-Id": "<20170919180038.26056-6-dgilbert@redhat.com>", "In-Reply-To": "<20170919180038.26056-1-dgilbert@redhat.com>", "References": "<20170919180038.26056-1-dgilbert@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\n\t(mx1.redhat.com [10.5.110.27]);\n\tTue, 19 Sep 2017 18:01:00 +0000 (UTC)", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "209.132.183.28", "Subject": "[Qemu-devel] [PATCH 5/5] migration: Route more error paths", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "peter.maydell@linaro.org, cohuck@redhat.com, rth@twiddle.net", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "From: \"Dr. David Alan Gilbert\" <dgilbert@redhat.com>\n\nvmstate_save is called in a few places, and vmstate_save_state is\ncalled in lots of places.\n\nRoute error returns from the easier cases back up; there are lots\nof more complex cases where there own error paths need fixing.\n\nSigned-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>\n---\n hw/display/virtio-gpu.c | 4 +---\n hw/virtio/virtio.c | 13 +++++++------\n include/hw/virtio/virtio.h | 2 +-\n migration/vmstate-types.c | 11 ++++++++---\n tests/test-vmstate.c | 6 +++---\n 5 files changed, 20 insertions(+), 16 deletions(-)", "diff": "diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c\nindex 622ee300f9..c9494e8a79 100644\n--- a/hw/display/virtio-gpu.c\n+++ b/hw/display/virtio-gpu.c\n@@ -996,9 +996,7 @@ static int virtio_gpu_save(QEMUFile *f, void *opaque, size_t size,\n }\n qemu_put_be32(f, 0); /* end of list */\n \n- vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL);\n-\n- return 0;\n+ return vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL);\n }\n \n static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,\ndiff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c\nindex 464947f76d..860333788b 100644\n--- a/hw/virtio/virtio.c\n+++ b/hw/virtio/virtio.c\n@@ -1899,7 +1899,7 @@ static const VMStateDescription vmstate_virtio = {\n }\n };\n \n-void virtio_save(VirtIODevice *vdev, QEMUFile *f)\n+int virtio_save(VirtIODevice *vdev, QEMUFile *f)\n {\n BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));\n VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);\n@@ -1949,20 +1949,21 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)\n }\n \n if (vdc->vmsd) {\n- vmstate_save_state(f, vdc->vmsd, vdev, NULL);\n+ int ret = vmstate_save_state(f, vdc->vmsd, vdev, NULL);\n+ if (ret) {\n+ return ret;\n+ }\n }\n \n /* Subsections */\n- vmstate_save_state(f, &vmstate_virtio, vdev, NULL);\n+ return vmstate_save_state(f, &vmstate_virtio, vdev, NULL);\n }\n \n /* A wrapper for use as a VMState .put function */\n static int virtio_device_put(QEMUFile *f, void *opaque, size_t size,\n VMStateField *field, QJSON *vmdesc)\n {\n- virtio_save(VIRTIO_DEVICE(opaque), f);\n-\n- return 0;\n+ return virtio_save(VIRTIO_DEVICE(opaque), f);\n }\n \n /* A wrapper for use as a VMState .get function */\ndiff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h\nindex 80c45c321e..5abada6966 100644\n--- a/include/hw/virtio/virtio.h\n+++ b/include/hw/virtio/virtio.h\n@@ -188,7 +188,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,\n void virtio_notify_irqfd(VirtIODevice *vdev, VirtQueue *vq);\n void virtio_notify(VirtIODevice *vdev, VirtQueue *vq);\n \n-void virtio_save(VirtIODevice *vdev, QEMUFile *f);\n+int virtio_save(VirtIODevice *vdev, QEMUFile *f);\n \n extern const VMStateInfo virtio_vmstate_info;\n \ndiff --git a/migration/vmstate-types.c b/migration/vmstate-types.c\nindex c056c98bdb..48184c380d 100644\n--- a/migration/vmstate-types.c\n+++ b/migration/vmstate-types.c\n@@ -550,13 +550,14 @@ static int put_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field,\n {\n const VMStateDescription *vmsd = field->vmsd;\n void *tmp = g_malloc(size);\n+ int ret;\n \n /* Writes the parent field which is at the start of the tmp */\n *(void **)tmp = pv;\n- vmstate_save_state(f, vmsd, tmp, vmdesc);\n+ ret = vmstate_save_state(f, vmsd, tmp, vmdesc);\n g_free(tmp);\n \n- return 0;\n+ return ret;\n }\n \n const VMStateInfo vmstate_info_tmp = {\n@@ -657,12 +658,16 @@ static int put_qtailq(QEMUFile *f, void *pv, size_t unused_size,\n /* offset of the QTAILQ entry in a QTAILQ element*/\n size_t entry_offset = field->start;\n void *elm;\n+ int ret;\n \n trace_put_qtailq(vmsd->name, vmsd->version_id);\n \n QTAILQ_RAW_FOREACH(elm, pv, entry_offset) {\n qemu_put_byte(f, true);\n- vmstate_save_state(f, vmsd, elm, vmdesc);\n+ ret = vmstate_save_state(f, vmsd, elm, vmdesc);\n+ if (ret) {\n+ return ret;\n+ }\n }\n qemu_put_byte(f, false);\n \ndiff --git a/tests/test-vmstate.c b/tests/test-vmstate.c\nindex e643ac662b..ab3e430c2c 100644\n--- a/tests/test-vmstate.c\n+++ b/tests/test-vmstate.c\n@@ -70,7 +70,7 @@ static void save_vmstate(const VMStateDescription *desc, void *obj)\n QEMUFile *f = open_test_file(true);\n \n /* Save file with vmstate */\n- vmstate_save_state(f, desc, obj, NULL);\n+ g_assert(!vmstate_save_state(f, desc, obj, NULL));\n qemu_put_byte(f, QEMU_VM_EOF);\n g_assert(!qemu_file_get_error(f));\n qemu_fclose(f);\n@@ -381,7 +381,7 @@ static void test_save_noskip(void)\n QEMUFile *fsave = open_test_file(true);\n TestStruct obj = { .a = 1, .b = 2, .c = 3, .d = 4, .e = 5, .f = 6,\n .skip_c_e = false };\n- vmstate_save_state(fsave, &vmstate_skipping, &obj, NULL);\n+ g_assert(!vmstate_save_state(fsave, &vmstate_skipping, &obj, NULL));\n g_assert(!qemu_file_get_error(fsave));\n \n uint8_t expected[] = {\n@@ -402,7 +402,7 @@ static void test_save_skip(void)\n QEMUFile *fsave = open_test_file(true);\n TestStruct obj = { .a = 1, .b = 2, .c = 3, .d = 4, .e = 5, .f = 6,\n .skip_c_e = true };\n- vmstate_save_state(fsave, &vmstate_skipping, &obj, NULL);\n+ g_assert(!vmstate_save_state(fsave, &vmstate_skipping, &obj, NULL));\n g_assert(!qemu_file_get_error(fsave));\n \n uint8_t expected[] = {\n", "prefixes": [ "5/5" ] }