[libvirt] PATCH: 20/28: Thread safety for node device driver

Daniel Veillard veillard at redhat.com
Wed Dec 3 10:44:09 UTC 2008


On Mon, Dec 01, 2008 at 12:05:40AM +0000, Daniel P. Berrange wrote:
> This patch makes the node device driver thread safe. Almost.
> 
> There is on outstanding problem in that the 'reload' method is implemented
> by just calling shutdown/startup. This causes the mutex we're locking on
> to be free'd and re-allocated. I'll fix this up later.

  reload operatiosn are IMHO one of the most dangerous ops in that
thread safe attempts, that's one of the operations where specific
testing will be a really good idea.

[...]
>  
>   failure:
> +    nodeDeviceUnlock(driver);
>      --ndevs;
>      while (--ndevs >= 0)
>          VIR_FREE(names[ndevs]);

  In general we use error: as the label for error exit paths, failure:
is being used only in src/node_device[_devkit/_hal].c: , probably
worth standardizing on the same label while we're at it.

  I will update HACKING to indicate the 3 usual label goto usages in
libvirt code:
  cleanup: common exit cleanup code
  error: error exit cleanup code
  retry: attempt at retrying an operation which failed due to a
         temporary state like a signal interrupting an I/O

  okay, there is more cleanups and refactoring in that patch, making the
change a bit harder to follow (especially in the DevKit part) but I
didn't found anything :-)  +1

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list