On Thu, Sep 12, 2013 at 08:27:07PM +0200, Christian Seiler wrote: > Hi there, > > just a quick question: currently, rootfs is pinned with a .hold file in > the parent directory (which btw. does not help against file systems that > are already mounted on the host but directly in the rootfs directory). > The problem with the .hold file is that it doesn't make the directory > necessarily pretty; I tend to mount all rootfs to /srv/lxc/$container > (config remaining in /var/lib/lxc), and then when doing a ls /srv/lxc, I > see tons of .hold files. (I'm not even sure that they are removed after > container termination - but even if they are, the default state of a > typical system tends to be that at least some containers are running...) > > Couldn't we just open $rootfs/lxc.hold for writing, keep the fd (as > current pinfd) and then unlink (!) the file directly? According to POSIX > semantics, the file is then still open and the pinning should work (now > also for the above case), but there are no files lying around anymore. > (Note: I didn't test that, it could well be that that doesn't work.) > > Thoughts?
Removing the file without closing the fd should work fine, just to confirm, I did: root@castiana:~# mount -t tmpfs tmpfs /mnt root@castiana:~# python3 Python 3.3.2+ (default, Jun 5 2013, 10:51:51) [GCC 4.8.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> fd = open("/mnt/a", "w+") >>> os.remove("/mnt/a") >>> [1]+ Stopped python3 root@castiana:~# mount -o remount,ro /mnt mount: /mnt is busy root@castiana:~# lsof -n | grep /mnt/a python3 9300 root 3u REG 0,46 0 289559 /mnt/a (deleted) root@castiana:~# fg python3 >>> root@castiana:~# mount -o remount,ro /mnt root@castiana:~# umount /mnt root@castiana:~# -- Stéphane Graber Ubuntu developer http://www.ubuntu.com
signature.asc
Description: Digital signature
------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel