[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] qemu-ga: guest-shutdown: become synchronous
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] qemu-ga: guest-shutdown: become synchronous |
Date: |
Fri, 11 May 2012 16:11:27 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
On 05/11/2012 01:19 PM, Luiz Capitulino wrote:
> Last commit dropped qemu-ga's SIGCHLD handler, used to automatically
> reap terminated children processes. This introduced a bug to
> qmp_guest_shutdown(): it will generate zombies.
>
> This problem probably doesn't matter in the success case, as the VM
> will shutdown anyway, but let's do the right thing and reap the
> created process. This ultimately means that guest-shutdown is now a
> synchronous command.
>
> An interesting side effect is that guest-shutdown is now able to
> report an error to the client if shutting down fails.
>
> Signed-off-by: Luiz Capitulino <address@hidden>
> ---
> qga/commands-posix.c | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> exit(!!ret);
> - } else if (ret < 0) {
> - error_set(err, QERR_UNDEFINED_ERROR);
> + } else if (pid < 0) {
> + goto exit_err;
> }
> +
> + rpid = waitpid(pid, &status, 0);
> + if (rpid == pid && WIFEXITED(status) && !WEXITSTATUS(status)) {
And another case where waitpid should be used in a loop.
Other than that, I'm in favor of this series.
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature