* Sun Nov 24 2024 Jon Maloy <jmaloy@redhat.com> - 9.1.0-4
- kvm-migration-Ensure-vmstate_save-sets-errp.patch [RHEL-67844] - Resolves: RHEL-67844 (qemu crashed after killed virtiofsd during migration)
This commit is contained in:
parent
639b862c69
commit
4fa66a0899
92
kvm-migration-Ensure-vmstate_save-sets-errp.patch
Normal file
92
kvm-migration-Ensure-vmstate_save-sets-errp.patch
Normal file
@ -0,0 +1,92 @@
|
||||
From 91f67a47a3fd31be578988d7ac11bb814314ec5a Mon Sep 17 00:00:00 2001
|
||||
From: Hanna Czenczek <hreitz@redhat.com>
|
||||
Date: Tue, 15 Oct 2024 19:04:37 +0200
|
||||
Subject: [PATCH] migration: Ensure vmstate_save() sets errp
|
||||
|
||||
RH-Author: Hanna Czenczek <hreitz@redhat.com>
|
||||
RH-MergeRequest: 295: migration: Ensure vmstate_save() sets errp
|
||||
RH-Jira: RHEL-67844
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
|
||||
RH-Commit: [1/1] df65f254fa6bf241b1fd4f4d2101f137d2a6e44b (hreitz/qemu-kvm-c-9-s)
|
||||
|
||||
migration/savevm.c contains some calls to vmstate_save() that are
|
||||
followed by migrate_set_error() if the integer return value indicates an
|
||||
error. migrate_set_error() requires that the `Error *` object passed to
|
||||
it is set. Therefore, vmstate_save() is assumed to always set *errp on
|
||||
error.
|
||||
|
||||
Right now, that assumption is not met: vmstate_save_state_v() (called
|
||||
internally by vmstate_save()) will not set *errp if
|
||||
vmstate_subsection_save() or vmsd->post_save() fail. Fix that by adding
|
||||
an *errp parameter to vmstate_subsection_save(), and by generating a
|
||||
generic error in case post_save() fails (as is already done for
|
||||
pre_save()).
|
||||
|
||||
Without this patch, qemu will crash after vmstate_subsection_save() or
|
||||
post_save() have failed inside of a vmstate_save() call (unless
|
||||
migrate_set_error() then happen to discard the new error because
|
||||
s->error is already set). This happens e.g. when receiving the state
|
||||
from a virtio-fs back-end (virtiofsd) fails.
|
||||
|
||||
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
|
||||
Link: https://lore.kernel.org/r/20241015170437.310358-1-hreitz@redhat.com
|
||||
Signed-off-by: Peter Xu <peterx@redhat.com>
|
||||
(cherry picked from commit 37dfcba1a04989830c706f9cbc00450e5d3a7447)
|
||||
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
|
||||
---
|
||||
migration/vmstate.c | 13 ++++++++-----
|
||||
1 file changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/migration/vmstate.c b/migration/vmstate.c
|
||||
index ef26f26ccd..d19b42630a 100644
|
||||
--- a/migration/vmstate.c
|
||||
+++ b/migration/vmstate.c
|
||||
@@ -22,7 +22,8 @@
|
||||
#include "trace.h"
|
||||
|
||||
static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
|
||||
- void *opaque, JSONWriter *vmdesc);
|
||||
+ void *opaque, JSONWriter *vmdesc,
|
||||
+ Error **errp);
|
||||
static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
|
||||
void *opaque);
|
||||
|
||||
@@ -440,12 +441,13 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
|
||||
json_writer_end_array(vmdesc);
|
||||
}
|
||||
|
||||
- ret = vmstate_subsection_save(f, vmsd, opaque, vmdesc);
|
||||
+ ret = vmstate_subsection_save(f, vmsd, opaque, vmdesc, errp);
|
||||
|
||||
if (vmsd->post_save) {
|
||||
int ps_ret = vmsd->post_save(opaque);
|
||||
- if (!ret) {
|
||||
+ if (!ret && ps_ret) {
|
||||
ret = ps_ret;
|
||||
+ error_setg(errp, "post-save failed: %s", vmsd->name);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -517,7 +519,8 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
|
||||
}
|
||||
|
||||
static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
|
||||
- void *opaque, JSONWriter *vmdesc)
|
||||
+ void *opaque, JSONWriter *vmdesc,
|
||||
+ Error **errp)
|
||||
{
|
||||
const VMStateDescription * const *sub = vmsd->subsections;
|
||||
bool vmdesc_has_subsections = false;
|
||||
@@ -545,7 +548,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
|
||||
qemu_put_byte(f, len);
|
||||
qemu_put_buffer(f, (uint8_t *)vmsdsub->name, len);
|
||||
qemu_put_be32(f, vmsdsub->version_id);
|
||||
- ret = vmstate_save_state(f, vmsdsub, opaque, vmdesc);
|
||||
+ ret = vmstate_save_state_with_err(f, vmsdsub, opaque, vmdesc, errp);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
2.45.1
|
||||
|
@ -149,7 +149,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \
|
||||
Summary: QEMU is a machine emulator and virtualizer
|
||||
Name: qemu-kvm
|
||||
Version: 9.1.0
|
||||
Release: 3%{?rcrel}%{?dist}%{?cc_suffix}
|
||||
Release: 4%{?rcrel}%{?dist}%{?cc_suffix}
|
||||
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
|
||||
# Epoch 15 used for RHEL 8
|
||||
# Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5)
|
||||
@ -268,6 +268,8 @@ Patch63: kvm-KVM-Define-KVM_MEMSLOTS_NUM_MAX_DEFAULT.patch
|
||||
Patch64: kvm-KVM-Rename-KVMMemoryListener.nr_used_slots-to-nr_slo.patch
|
||||
# For RHEL-57682 - Bad migration performance when performing vGPU VM live migration
|
||||
Patch65: kvm-KVM-Rename-KVMState-nr_slots-to-nr_slots_max.patch
|
||||
# For RHEL-67844 - qemu crashed after killed virtiofsd during migration
|
||||
Patch66: kvm-migration-Ensure-vmstate_save-sets-errp.patch
|
||||
|
||||
%if %{have_clang}
|
||||
BuildRequires: clang
|
||||
@ -1334,6 +1336,11 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Sun Nov 24 2024 Jon Maloy <jmaloy@redhat.com> - 9.1.0-4
|
||||
- kvm-migration-Ensure-vmstate_save-sets-errp.patch [RHEL-67844]
|
||||
- Resolves: RHEL-67844
|
||||
(qemu crashed after killed virtiofsd during migration)
|
||||
|
||||
* Tue Nov 19 2024 Miroslav Rezanina <mrezanin@redhat.com> - 9.1.0-3
|
||||
- kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch [RHEL-11043]
|
||||
- kvm-kvm-replace-fprintf-with-error_report-printf-in-kvm_.patch [RHEL-57682]
|
||||
|
Loading…
Reference in New Issue
Block a user