|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] Re: [PATCH] Fix bootloader handling when empty string is bei
On 08/31/2010 10:47 AM, Ian Campbell wrote:
On Mon, 2010-08-30 at 14:10 +0100, Michal Novotny wrote:
Hi,
this is the patch to fix empty string as the output value
of the bootloader string. If there is no output then
xend is being hung indefinitely unless you press Ctrl + C keys
to trigger SIGINT.
I think a similar fix will be needed to libxl_bootloader.c, right?
Yes.
Could we potentially avoid the need to use a select timeout to poll for
bootloader exit by including the bootloader FIFO FD and/or the PTY FDs
in the select's exceptfds array? Presumably if the process on the other
end of such an FD exits that causes some sort of exceptional condition
(although historically I've had trouble finding the actual specified
behaviour in cases like this).
Using the FIFO is not possible in general because you cannot be sure
that the bootloader is opening it at all. In fact, in this case both
libxl and xend will hang at "fifo_fd = open(fifo, O_RDONLY);" so you
have to apply O_NDELAY already when you open the FIFO.
Also, in the case the bootloader is not opening the FIFO at all, doing
the waitpid in the same thread has a race if the process exits between
the waitpid and select. Fixing the race requires pselect and,
especially in Python, introduces more complications than it removes.
So, for RHEL5 xend, Michal has a better version of the patch that will
run the waitpid in a separate thread, and use a pipe to wake up the
select. This does the same thing as /proc, but portably and without the
need for polling.
However, for both current xend and libxl, using the PTY sounds better,
and it looks like an even simpler patch will work that:
- uses O_RDONLY|O_NDELAY when opening the FIFO, and
- exits bootloader_interact when bootloader_fd was in the returned rsel
but ret == 0.
Paolo
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|