[libvirt] [PATCH v2 6/8] virFDStream: Add option for delete file after it's opening

Eric Blake eblake at redhat.com
Thu Apr 7 22:07:36 UTC 2011


On 04/06/2011 02:59 AM, Daniel P. Berrange wrote:
> On Tue, Apr 05, 2011 at 10:55:40AM -0600, Eric Blake wrote:
>> On 04/05/2011 10:12 AM, Michal Privoznik wrote:
>>> This is needed if we want to transfer a temporary file. If the
>>> transfer is done with iohelper, we might run into a race condition,
>>> where we unlink() file before iohelper is executed.
>>>
>>> * src/fdstream.c, src/fdstream.h,
>>>   src/util/iohelper.c: Add new option
>>> * src/lxc/lxc_driver.c, src/qemu/qemu_driver.c,
>>>   src/storage/storage_driver.c, src/uml/uml_driver.c,
>>>   src/xen/xen_driver.c: Expand existing function calls
>>
>> I'm not convinced about this commit.  We should instead be fixing
>> iohelper to receive its file by fd inheritance, so that it doesn't have
>> to open() in the first place.  Then you don't need iohelper to worry
>> about unlink().
> 
> My intention was that iohelper could also do uid/gid changes
> in the future to cope with opening files on root squashing
> NFS. For that we'd want it to be doing the open, not libvirtd

Even if the parent process does virFileOpenAs?  I think we've already
got all the uid/gid changes covered in the parent process, without
having to offload that into the child and coordinate a second open();
and even if we don't, fchmod/fchown are better than a second
open()/chmod()/chown().

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110407/a1b48869/attachment-0001.sig>


More information about the libvir-list mailing list