[CRIU] [PATCH] Do not fail if /tmp does not exist

Saied Kazemi saied at google.com
Tue Apr 7 01:19:44 PDT 2015


On Mon, Apr 6, 2015 at 11:28 PM, Pavel Emelyanov <xemul at parallels.com>
wrote:

> On 04/07/2015 08:49 AM, Andrew Vagin wrote:
> > On Mon, Apr 06, 2015 at 09:22:19AM -0700, Saied Kazemi wrote:
> >> Currently if /tmp does not exist, CRIU fails because it will not be
> >> able to create a temporary directory there.  But when checkpointing
> >> and restoring containers, we cannot rely on the existence of /tmp.
> >> For such containers, we should use root (/).  The temporary directory
> >> will be removed after CRIU is done.
> >>
> > Acked-by: Andrew Vagin <avagin at odin.com>
> >> Signed-off-by: Saied Kazemi <saied at google.com>
>
> Applied, thanks!
>
> I have a question though
>
> >> @@ -803,7 +805,10 @@ static int open_mountpoint(struct mount_info *pm)
> >>      if (switch_ns(root_item->pid.real, &mnt_ns_desc, &ns_old) < 0)
> >>              goto out;
> >>
> >> -    if (mkdtemp(mnt_path) == NULL) {
> >> +    mnt_path = mkdtemp(mnt_path_tmp);
> >> +    if (mnt_path == NULL && errno == ENOENT)
> >> +            mnt_path = mkdtemp(mnt_path_root);
>
> What's the point in trying to go with /tmp and then falling back to /?
> Why not just go ahead and always mkdtemp dir in /?
>

No "hard" reason -- mainly for compatibility with the original code as well
as conforming to the practice of using /tmp for temporary stuff.  There's
no performance penalty unless it fails which, in practice, I think it'd be
less than 1% of the cases.  That said, I have no objection to always using
/.


>> +    if (mnt_path == NULL) {
> >>              pr_perror("Can't create a temporary directory");
> >>              goto out;
> >>      }
>
> -- Pavel
>

--Saied
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20150407/977c9463/attachment.html>


More information about the CRIU mailing list