[PATCH 2/5] qemu: monitor: set error flag even in OOM conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



lastError.code is used as flag in qemu monitor. Unfortunately
due to temporary OOM conditions (very unlikely through as thread local
error is allocated on first use) we can fail to set this flag
in case of monitor eofs/errors. This can cause hangs.

Let's make sure flag is always set in case eofs/errors.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 src/qemu/qemu_monitor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 7b64752..e3fedd3 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -765,6 +765,11 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque)
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("Error while processing monitor IO"));
             virCopyLastError(&mon->lastError);
+
+            /* set error code if due to OOM conditions we fail to set it before */
+            if (mon->lastError.code == VIR_ERR_OK)
+                mon->lastError.code = VIR_ERR_INTERNAL_ERROR;
+
             virResetLastError();
         }
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux