[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] virsh: block SIGINT while getting BlockJobInfo



On 10/11/2012 09:12 AM, Ján Tomko wrote:
> SIGINT hasn't been blocked, which could lead to losing it somewhere in
> virDomainGetBlockJobInfo and not aborting the job.

Indeed, looking at vshWatchJob, we do the same around other libvirt APIs
when waiting for Ctrl-C; the problem is that if SIGINT arrives in the
middle of a libvirt API, then it can cause poll() to fail with EINTR,
and libvirt doesn't handle that well.  Delaying the SIGINT until after
we are out of libvirt API, and thus sure that an embedded poll() won't
be interrupted, prevents some odd failures, including failures which
leave the block job running instead of halting it.

[I still wonder if libvirt shouldn't be so sensitive to EINTR failures
on poll(), and/or whether the virsh loop should be a bit smarter about
handling libvirt failure when it also knows that SIGINT fired, but
that's a question for another day]

[Also for another day - blockcopy, blockpull, and blockcommit share an
awfully similar Ctrl-C polling loop.  It might be nice to refactor this
code to avoid the duplication, and/or convert things over to waiting for
libvirt events instead of polling]

> ---
>  tools/virsh-domain.c |   24 ++++++++++++++++++------
>  1 files changed, 18 insertions(+), 6 deletions(-)

ACK and pushed, with one nit:

> @@ -1674,7 +1682,7 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
>      int timeout = 0;
>      struct sigaction sig_action;
>      struct sigaction old_sig_action;
> -    sigset_t sigmask;
> +    sigset_t sigmask,oldsigmask;

Missing a space here.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]