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

Re: [libvirt] [PATCH] fdstream: drop delete argument



On 08/02/2011 01:18 PM, Laine Stump wrote:
On 08/02/2011 01:31 PM, Eric Blake wrote:
Revert 6a1f5f568f8. Now that libvirt_iohelper no longer has a
race where it can open() a file after the parent process has
unlink()d the same file, it makes more sense to make the callers
both create and unlink, rather than the caller create and the
stream unlink.


I wasn't paying attention to the messages/patches related to the race
condition you reference,

Commit 1eb66479 plugged the race; commit 6a1f5f5 introduced the race in the first place.

The problem was that if we use libvirt_iohelper, and the child process calls open(), but the parent process calls unlink() before the child process gets to run very far, then the child process will fail to open(). But by changing fdstream to pass the fd to libvirt-iohelper by fd inheritance instead of by name-wise open() calls, there is no longer an open() race, so we can once again unlink() in the parent.

> but this (caller creates and unlinks)
definitely seems cleaner than the other way. Beyond that, the patch
seems to be correct. ACK.

Should this go in for 0.9.4, or am I correct in deferring it until after the release?

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


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