|
|
9ae3a8 |
From f917e135d99ab0749ab747b3abce45e78de8c479 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 14 Feb 2014 08:27:07 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 3/3] monitor: Cleanup mon->outbuf on write error
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
Message-id: <a12d1cd833d1021980196981ad66eb268e26e507.1392365234.git.amit.shah@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 57275
|
|
|
9ae3a8 |
O-Subject: [RHEL 7.0 qemu-kvm PATCH 1/1] monitor: Cleanup mon->outbuf on write error
|
|
|
9ae3a8 |
Bugzilla: 1065225
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Stratos Psomadakis <psomas@grnet.gr>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
In case monitor_flush() fails to write the contents of mon->outbuf to
|
|
|
9ae3a8 |
the output device, mon->outbuf is not cleaned up properly. Check the
|
|
|
9ae3a8 |
return code of the qemu_chr_fe_write() function and cleanup the outbuf
|
|
|
9ae3a8 |
if it fails.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
References: http://lists.nongnu.org/archive/html/qemu-devel/2014-01/msg02890.html
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1065225
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Stratos Psomadakis <psomas@grnet.gr>
|
|
|
9ae3a8 |
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
|
|
|
9ae3a8 |
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 056f49ff2cf645dc484956b00b65a3aa18a1a9a3)
|
|
|
9ae3a8 |
Signed-off-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
monitor.c | 4 ++--
|
|
|
9ae3a8 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
monitor.c | 4 ++--
|
|
|
9ae3a8 |
1 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/monitor.c b/monitor.c
|
|
|
9ae3a8 |
index 8f36f91..a6abfb5 100644
|
|
|
9ae3a8 |
--- a/monitor.c
|
|
|
9ae3a8 |
+++ b/monitor.c
|
|
|
9ae3a8 |
@@ -287,8 +287,8 @@ void monitor_flush(Monitor *mon)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (len && !mon->mux_out) {
|
|
|
9ae3a8 |
rc = qemu_chr_fe_write(mon->chr, (const uint8_t *) buf, len);
|
|
|
9ae3a8 |
- if (rc == len) {
|
|
|
9ae3a8 |
- /* all flushed */
|
|
|
9ae3a8 |
+ if ((rc < 0 && errno != EAGAIN) || (rc == len)) {
|
|
|
9ae3a8 |
+ /* all flushed or error */
|
|
|
9ae3a8 |
QDECREF(mon->outbuf);
|
|
|
9ae3a8 |
mon->outbuf = qstring_new();
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|