[CRIU] [PATCH] Fall back to opening image files readonly if readwrite fails.

Andrei Vagin avagin at virtuozzo.com
Fri Aug 17 02:32:08 MSK 2018


Applied, thanks!

On Mon, Jul 30, 2018 at 06:47:34PM +0200, Pawel Stradomski wrote:
> This can happen when running in user namespace with auto-dedup enabled.
> Right now this means auto-dedup gets disabled.
> 
> Signed-off-by: Pawel Stradomski <pstradomski at google.com>
> ---
>  criu/mem.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/criu/mem.c b/criu/mem.c
> index 44d0e258..0ae0edd2 100644
> --- a/criu/mem.c
> +++ b/criu/mem.c
> @@ -1276,6 +1276,15 @@ static int prepare_vma_ios(struct pstree_item *t, struct task_restore_args *ta)
>  	 */
>  	pages = open_image(CR_FD_PAGES, opts.auto_dedup ? O_RDWR : O_RSTR,
>  				rsti(t)->pages_img_id);
> +	/* When running inside namespace we might lack privileges to open the file
> +	 * for writing.
> +	 * TODO: use userns_call to do the opening instead of downgrading to opening
> +	 * read-only.
> +	 */
> +	if (!pages && opts.auto_dedup) {
> +		pr_warn("Failed to open image read-write, trying read-only instead. auto-dedup won't work\n");
> +		pages = open_image(CR_FD_PAGES, O_RSTR, rsti(t)->pages_img_id);
> +	}
>  	if (!pages)
>  		return -1;
>  
> -- 
> 2.18.0.345.g5c9ce644c3-goog
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list