[lxc-devel] [PATCH] c/r: force users to provide a fresh directory for criu images
serge.hallyn at ubuntu.com
Fri Apr 24 04:12:29 UTC 2015
Quoting Tycho Andersen (tycho.andersen at canonical.com):
> On Wed, Apr 22, 2015 at 10:26:17PM +0000, Serge Hallyn wrote:
> > Quoting Tycho Andersen (tycho.andersen at canonical.com):
> > > On Wed, Apr 22, 2015 at 01:16:08PM -0600, Tycho Andersen wrote:
> > > > CRIU can get confused if more than one c/r is done in the same directory, so we
> > > > should require lxcapi so that it refuses to dump to a directory with criu
> > > > images already in it.
> > >
> > > Hmm, actually I'm not sure this is the best way to do this. If users
> > > (e.g. LXD) use some sort of mechanism to generate a temporary
> > > directory name we could race if the same name is tried twice in a row.
> > ?
> > You mean if they use something like mkstemp and two threads get the
> > same name from it? (that shouldn't happen)
> The problem is that we pass liblxc the dirname, but this patch means
> that liblxc creates the directory. mkstemp (and go's equivalent,
> ioutil.TempDir) works because it opens the file, so presumably they
> test to see that it doesn't exist.
> However, we'd have to remove the directory after TempDir creates it,
> because liblxc wants to create it. That could get us into a situation
> where another TempDir call might generate the same name, in between
> when we remove it and when liblxc creates it.
> > > Instead, maybe it's just best to stat() for the key criu image file
> > > (inventory.img), and die if it's there.
> > >
> > > Thoughts?
I think we'll go with whatever you think is best :)
More information about the lxc-devel