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

Pavel Emelyanov xemul at parallels.com
Mon Apr 6 23:28:55 PDT 2015


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 /?

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

-- Pavel



More information about the CRIU mailing list