monitor: guard iothread access by mon->use_io_thread
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 25 Sep 2018 08:15:06 +0000 (10:15 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 6 Nov 2018 16:02:49 +0000 (17:02 +0100)
monitor_resume() and monitor_suspend() both want to
"kick" the I/O thread if it is there, but in
monitor_suspend() lacked the use_io_thread flag condition.
This is required when we later only spawn the thread on
first use.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180925081507.11873-2-w.bumiller@proxmox.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
monitor.c

index 823b5a1099d657c64f6e10892edbf9d27327fc77..66f149c1dce5095c414caeb6c5900dfa3fbf9953 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -4292,7 +4292,7 @@ int monitor_suspend(Monitor *mon)
 
     atomic_inc(&mon->suspend_cnt);
 
-    if (monitor_is_qmp(mon)) {
+    if (monitor_is_qmp(mon) && mon->use_io_thread) {
         /*
          * Kick I/O thread to make sure this takes effect.  It'll be
          * evaluated again in prepare() of the watch object.