qemu-kvm/kvm-qemu-file-Don-t-do-IO-after-shutdown.patch

93 lines
2.5 KiB
Diff
Raw Normal View History

* Wed Mar 11 2020 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.2.0-14.el8 - kvm-hw-smbios-set-new-default-SMBIOS-fields-for-Windows-.patch [bz#1782529] - kvm-migration-multifd-clean-pages-after-filling-packet.patch [bz#1738451] - kvm-migration-Make-sure-that-we-don-t-call-write-in-case.patch [bz#1738451] - kvm-migration-multifd-fix-nullptr-access-in-terminating-.patch [bz#1738451] - kvm-migration-multifd-fix-destroyed-mutex-access-in-term.patch [bz#1738451] - kvm-multifd-Make-sure-that-we-don-t-do-any-IO-after-an-e.patch [bz#1738451] - kvm-qemu-file-Don-t-do-IO-after-shutdown.patch [bz#1738451] - kvm-migration-Don-t-send-data-if-we-have-stopped.patch [bz#1738451] - kvm-migration-Create-migration_is_running.patch [bz#1738451] - kvm-migration-multifd-fix-nullptr-access-in-multifd_send.patch [bz#1738451] - kvm-migration-Maybe-VM-is-paused-when-migration-is-cance.patch [bz#1738451] - kvm-virtiofsd-Remove-fuse_req_getgroups.patch [bz#1797064] - kvm-virtiofsd-fv_create_listen_socket-error-path-socket-.patch [bz#1797064] - kvm-virtiofsd-load_capng-missing-unlock.patch [bz#1797064] - kvm-virtiofsd-do_read-missing-NULL-check.patch [bz#1797064] - kvm-tools-virtiofsd-fuse_lowlevel-Fix-fuse_out_header-er.patch [bz#1797064] - kvm-virtiofsd-passthrough_ll-cleanup-getxattr-listxattr.patch [bz#1797064] - kvm-virtiofsd-Fix-xattr-operations.patch [bz#1797064] - Resolves: bz#1738451 (qemu on src host core dump after set multifd-channels and do migration twice (first migration execute migrate_cancel)) - Resolves: bz#1782529 (Windows Update Enablement with default smbios strings in qemu) - Resolves: bz#1797064 (virtiofsd: Fixes)
2020-03-11 20:25:54 +00:00
From d84814e298e3b05fb5bc61cc8e641a5e104d32d5 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Tue, 3 Mar 2020 14:51:39 +0000
Subject: [PATCH 07/18] qemu-file: Don't do IO after shutdown
RH-Author: Juan Quintela <quintela@redhat.com>
Message-id: <20200303145143.149290-7-quintela@redhat.com>
Patchwork-id: 94116
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 06/10] qemu-file: Don't do IO after shutdown
Bugzilla: 1738451
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Peter Xu <peterx@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Be sure that we are not doing neither read/write after shutdown of the
QEMUFile.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
(cherry picked from commit a555b8092abc6f1bbe4b64c516679cbd68fcfbd8)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
migration/qemu-file.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 26fb25d..bbb2b63 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -53,6 +53,8 @@ struct QEMUFile {
int last_error;
Error *last_error_obj;
+ /* has the file has been shutdown */
+ bool shutdown;
};
/*
@@ -61,10 +63,18 @@ struct QEMUFile {
*/
int qemu_file_shutdown(QEMUFile *f)
{
+ int ret;
+
+ f->shutdown = true;
if (!f->ops->shut_down) {
return -ENOSYS;
}
- return f->ops->shut_down(f->opaque, true, true, NULL);
+ ret = f->ops->shut_down(f->opaque, true, true, NULL);
+
+ if (!f->last_error) {
+ qemu_file_set_error(f, -EIO);
+ }
+ return ret;
}
/*
@@ -214,6 +224,9 @@ void qemu_fflush(QEMUFile *f)
return;
}
+ if (f->shutdown) {
+ return;
+ }
if (f->iovcnt > 0) {
expect = iov_size(f->iov, f->iovcnt);
ret = f->ops->writev_buffer(f->opaque, f->iov, f->iovcnt, f->pos,
@@ -328,6 +341,10 @@ static ssize_t qemu_fill_buffer(QEMUFile *f)
f->buf_index = 0;
f->buf_size = pending;
+ if (f->shutdown) {
+ return 0;
+ }
+
len = f->ops->get_buffer(f->opaque, f->buf + pending, f->pos,
IO_BUF_SIZE - pending, &local_error);
if (len > 0) {
@@ -642,6 +659,9 @@ int64_t qemu_ftell(QEMUFile *f)
int qemu_file_rate_limit(QEMUFile *f)
{
+ if (f->shutdown) {
+ return 1;
+ }
if (qemu_file_get_error(f)) {
return 1;
}
--
1.8.3.1