[PATCH] qemu: fix race in signal interrupt during QEMU startup

Michal Privoznik mprivozn at redhat.com
Thu Jul 30 08:30:43 UTC 2020


On 7/29/20 8:03 PM, Daniel P. Berrangé wrote:
> If a Ctrl-C arrives while we are in the middle of executing the
> virDomainCreateXML call, we will have no "virDomainPtr" object
> available, but QEMU may none the less be running.
> 
> This means we'll never try to stop the QEMU process before we
> honour the Ctrl-C and exit.
> 
> To deal with this race we need to postpone quit of the event
> loop if it is requested while in the middle of domain startup.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>   src/qemu/qemu_shim.c | 77 +++++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 72 insertions(+), 5 deletions(-)
> 
> diff --git a/src/qemu/qemu_shim.c b/src/qemu/qemu_shim.c
> index 7e87b8fb96..bbcf9dc886 100644
> --- a/src/qemu/qemu_shim.c
> +++ b/src/qemu/qemu_shim.c
> @@ -30,19 +30,61 @@
>   
>   #define VIR_FROM_THIS VIR_FROM_QEMU
>   
> +static GMutex eventLock;
> +static bool eventNoQuitFlag;

This is not very mnemonic name. How about "eventPreventQuitFlag"?

Reviewed-by: Michal Privoznik <mprivozn at redhat.com>

Michal




More information about the libvir-list mailing list