From: "Denis V. Lunev" <den@openvz.org>
To: qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <fam@euphon.net>,
Juan Quintela <quintela@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Denis Plotnikov <dplotnikov@virtuozzo.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Denis V. Lunev" <den@openvz.org>
Subject: [PATCH 1/7] migration/savevm: respect qemu_fclose() error code in save_snapshot()
Date: Fri, 3 Jul 2020 19:11:24 +0300 [thread overview]
Message-ID: <20200703161130.23772-2-den@openvz.org> (raw)
In-Reply-To: <20200703161130.23772-1-den@openvz.org>
qemu_fclose() could return error, f.e. if bdrv_co_flush() will return
the error.
This validation will become more important once we will start waiting of
asynchronous IO operations, started from bdrv_write_vmstate(), which are
coming soon.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
CC: Fam Zheng <fam@euphon.net>
CC: Juan Quintela <quintela@redhat.com>
CC: Denis Plotnikov <dplotnikov@virtuozzo.com>
---
migration/savevm.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index b979ea6e7f..da3dead4e9 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2628,7 +2628,7 @@ int save_snapshot(const char *name, Error **errp)
{
BlockDriverState *bs, *bs1;
QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
- int ret = -1;
+ int ret = -1, ret2;
QEMUFile *f;
int saved_vm_running;
uint64_t vm_state_size;
@@ -2712,10 +2712,14 @@ int save_snapshot(const char *name, Error **errp)
}
ret = qemu_savevm_state(f, errp);
vm_state_size = qemu_ftell(f);
- qemu_fclose(f);
+ ret2 = qemu_fclose(f);
if (ret < 0) {
goto the_end;
}
+ if (ret2 < 0) {
+ ret = ret2;
+ goto the_end;
+ }
/* The bdrv_all_create_snapshot() call that follows acquires the AioContext
* for itself. BDRV_POLL_WHILE() does not support nested locking because
--
2.17.1
next prev parent reply other threads:[~2020-07-03 16:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-03 16:11 [PATCH v6 0/7] block: seriously improve savevm/loadvm performance Denis V. Lunev
2020-07-03 16:11 ` Denis V. Lunev [this message]
2020-07-09 10:26 ` [PATCH 1/7] migration/savevm: respect qemu_fclose() error code in save_snapshot() Juan Quintela
2020-07-03 16:11 ` [PATCH 2/7] block/aio_task: allow start/wait task from any coroutine Denis V. Lunev
2020-07-03 16:11 ` [PATCH 3/7] block/aio_task: drop aio_task_pool_wait_one() helper Denis V. Lunev
2020-07-03 16:11 ` [PATCH 4/7] block/block-backend: remove always true check from blk_save_vmstate Denis V. Lunev
2020-07-03 16:11 ` [PATCH 5/7] block, migration: add bdrv_finalize_vmstate helper Denis V. Lunev
2020-07-03 16:11 ` [PATCH 6/7] block/io: improve savevm performance Denis V. Lunev
2020-07-03 16:11 ` [PATCH 7/7] block/io: improve loadvm performance Denis V. Lunev
2020-07-03 16:55 ` [PATCH v6 0/7] block: seriously improve savevm/loadvm performance no-reply
-- strict thread matches above, loose matches on Subject: below --
2020-07-03 17:35 [PATCH v7 " Denis V. Lunev
2020-07-03 17:35 ` [PATCH 1/7] migration/savevm: respect qemu_fclose() error code in save_snapshot() Denis V. Lunev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200703161130.23772-2-den@openvz.org \
--to=den@openvz.org \
--cc=dplotnikov@virtuozzo.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).