diff mbox series

[1/2] monitor: guard iothread access by mon->use_io_thread

Message ID 20180921082856.1000-1-w.bumiller@proxmox.com
State New
Headers show
Series [1/2] monitor: guard iothread access by mon->use_io_thread | expand

Commit Message

Wolfgang Bumiller Sept. 21, 2018, 8:28 a.m. UTC
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>
---
 monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Blake Sept. 24, 2018, 2:01 p.m. UTC | #1
On 9/21/18 3:28 AM, Wolfgang Bumiller wrote:
> 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.
> 

When sending a multi-patch series (yes, even two patches counts), it's 
best to send a 0/2 cover letter, to make it easier for automated CI 
tooling to recognize the series.

> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
>   monitor.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/monitor.c b/monitor.c
> index 021c11b1bf..4802148c82 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -4380,7 +4380,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.
>
Peter Xu Sept. 25, 2018, 4:12 a.m. UTC | #2
On Fri, Sep 21, 2018 at 10:28:55AM +0200, Wolfgang Bumiller wrote:
> 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: Peter Xu <peterx@redhat.com>

> ---
>  monitor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/monitor.c b/monitor.c
> index 021c11b1bf..4802148c82 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -4380,7 +4380,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.
> -- 
> 2.11.0
> 
> 

Regards,
diff mbox series

Patch

diff --git a/monitor.c b/monitor.c
index 021c11b1bf..4802148c82 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4380,7 +4380,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.