[CRIU] [RFC][PATCH 0/3] Proposal for native (w/o plugins) support for external bind mounts

Pavel Emelyanov xemul at parallels.com
Thu Jun 5 02:21:03 PDT 2014


On 06/05/2014 01:10 PM, Andrew Vagin wrote:
> On Tue, Jun 03, 2014 at 08:26:59PM +0400, Pavel Emelyanov wrote:
>> Hi,
>>
>> I'd like to propose an API to support external mount points w/o plugins.
>> It's a typical scenario when people just do a bind mount before going
>> into chroot/pivot_root and starting a container. Such a construction is
>> not dumpable by CRIU, but I think it's possibly to handle the common and
>> typical scenario.
>>
>> That said, the proposal is to introduce the --ext-mount option with the
>> syntax:
>>
>> --ext-mount without arguments on dump says, that mount point with the 
>> source sitting outside of the namespace root should be dumped "as is". 
>> On restore this will say to try create bind mount with unchanged source
>> path. It's useful for suspend/resume scenario and for live-migration
>> between hosts with identical FS paths.
>>
>> --ext-mount p<path>, e.g. --ext-mount p/foo on restore will cause the
>> <path> be prepended to any bind mount source. IOW /bar bind mounted into
>> /root will result in /foo/bar get bind mounted into /root on restore
>>
>> --ext-mount s<delim><path1><delim><path2>, e.g. --ext-mount s:/foo:/bar
>> will case the <path1> prefix get substituted with <path2> prefix for
>> every external bind mount on restore. IOW /foo/foobar bind mounted into
>> /root will result in /bar/foobar bind mounted to /root on restore.
> 
> We can have two pathes with identical prefix (e.g. /dev/pts/7 and
> /dev/pts77) and than we can decided to replace /dev/pts/7 on /dev/pts/8
> and /dev/pts/77 on /dev/pts/9.
> 
> Can this situation be handled by this interface?

No, the tail of the path should remain unchaged.

I've just realized that the whole API sucks. If we bind mount a file
from non root filesystem, then the root path in mountinfo will only
contain the part of the path to _its_ fs root, not to the global root.
I.e. if we have tmpfs mounted at /foo and bind mount /foo/bar into
container, then we'll dump /bar as the root of the mount point.

We should have some better --ext-mount syntax. Gone thinking.


More information about the CRIU mailing list