[Libguestfs] [PATCH 0/3] Alternate way to avoid race conditions when nbdkit exits.

Richard W.M. Jones rjones at redhat.com
Fri Nov 17 08:36:24 UTC 2017


On Thu, Nov 16, 2017 at 05:09:57PM -0600, Eric Blake wrote:
> Here, I'm less sure of what would reliably solve things; maybe we want a
> pipe-to-self setup where our signal handler (which currently sets !quit)
> instead (or in addition) writes into the pipe so that our event loop
> (the poll() in accept_connect()) has an additional fd it can poll in
> parallel to all the socket fds; that way, the arrival of a signal will
> ensure that poll() wakes up even without any of the pending socket fds
> receiving another connection.

A pipe-to-self does sound like the better solution here.  poll() will
return immediately that way.

However the implementation of that will be horrible since I think
we'll finally need to keep track of each thread.  OTOH keeping track
of each thread also seems to be necessary to solve the problem you
mentioned on IRC where we pass stack data to pthread_create.

If you want me to look at fixing any of these things let me know,
otherwise I'll just wait & review patches as posted.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list