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

Re: [Xen-devel] [PATCH] libxl: make libxl_wait_for_device_model not racy



On Wed, 23 Jun 2010, Jeremy Fitzhardinge wrote:
> On 06/23/2010 12:15 PM, Stefano Stabellini wrote:
> > Hi all,
> > at the moment libxl_wait_for_device_model waits on a xenstore watch
> > before checking the current value of the xenstore node, that might
> > contain already the value the function was looking for.
> > This patch changes libxl_wait_for_device_model so that it checks the
> > value of the xenstore node first, then waits for the watch.
> >   
> 
> That can't help because it's still racy: what if the value changes
> between the first check and the wait?  The watch must fire immediately
> if the value is already in the desired state, or there's an unavoidable
> deadlock.

The check is done after the watch is set, so the wait would return
immediately.

> 
> On the other hand, the check-then-wait pattern reads more clearly, I think.
> 

I agree on this.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.