[CRIU] [PATCH 3/5] files: Rework clean_one_remap to order ghost dirs removal

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Feb 26 16:09:15 MSK 2019


>   static int clean_one_remap(struct remap_info *ri)
> @@ -733,15 +831,19 @@ static int clean_one_remap(struct remap_info *ri)
>   
>   	pr_info("Unlink remap %s\n", remap->rpath);
>   
> -	ret = unlinkat(rmntns_root, remap->rpath, remap->is_dir ? AT_REMOVEDIR : 0);
> -	if (ret < 0) {
> +	if (remap->is_dir)
> +		ret = clean_ghost_dir(rmntns_root, ri);
> +	else
> +		ret = unlinkat(rmntns_root, remap->rpath, 0);
> +
> +	if (ret) {
> +		pr_perror("Couldn't unlink remap %d %s", rmntns_root, remap->rpath);
>   		close(rmntns_root);
> -		pr_perror("Couldn't unlink remap %s %s", path, remap->rpath);

Missed these previously, why you change path to rmntns_root? Please see 
commit caaedad3f ("files-reg: make error message in clean_one_remap 
contain mntns path")

>   		return -1;
>   	}
> +
>   	close(rmntns_root);
>   	remap->rpath[0] = 0;
> -
>   	return 0;
>   }
>   
> @@ -767,6 +869,7 @@ static struct collect_image_info remap_cinfo = {
>   	.pb_type = PB_REMAP_FPATH,
>   	.priv_size = sizeof(struct remap_info),
>   	.collect = collect_one_remap,
> +	.flags = COLLECT_SHARED,
>   };
>   
>   /* Tiny files don't need to generate chunks in ghost image. */
> 

-- 
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.



More information about the CRIU mailing list