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

Pavel Emelyanov xemul at parallels.com
Tue Apr 7 04:51:09 PDT 2015


>     >> @@ -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 /.

Ah, OK :) Then let it be the way it is now. After all the final solution should
be done using the new mounting API in the kernel (in progress for ... quite a while
already) which will let us eliminate all the temp directories.

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

-- Pavel



More information about the CRIU mailing list