[CRIU] The --check-only feature

Andrey Vagin avagin at virtuozzo.com
Fri Sep 22 22:49:50 MSK 2017


On Thu, Sep 21, 2017 at 10:48:24PM -0700, Andrey Vagin wrote:
> On Thu, Sep 21, 2017 at 04:35:31PM +0300, Pavel Emelyanov wrote:
> > Hi, Adrian
> > 
> > We've had the --check-only patches in criu-dev for a while. What do you
> > think, is the feature ready to get merged into master branch?
> 
> It is not ready! It will be ready when it will pass all tests:

And I found that it is completely borken now.

criu dump --check-only and then criu restore --check-only doesn't work a
new process

[root at fc24 criu]# python test/zdtm.py run -t zdtm/static/env00 --check-only
=== Run 1/1 ================ zdtm/static/env00

========================== Run zdtm/static/env00 in h ==========================
Start test
./env00 --pidfile=env00.pid --outfile=env00.out --envname=ENV_00_TEST
Run criu dump in check-only mode
dump -o dump.chk.log -D dump/zdtm/static/env00/36/1.check -v4 -t 36 --pidfile /root/git/main/criu/test/zdtm/static/env00.pid --timeout 10 --check-only
Only checking if requested operation will succeed
Run criu dump
dump -o dump.log -D dump/zdtm/static/env00/36/1 -v4 -t 36 --pidfile /root/git/main/criu/test/zdtm/static/env00.pid --timeout 10
Run criu restore in check-only mode
restore -o restore.chk.log -D dump/zdtm/static/env00/36/1.check -v4 --pidfile /root/git/main/criu/test/zdtm/static/env00.pid --restore-detached --check-only
Only checking if requested operation will succeed
Checking mode enabled
=[log]=> dump/zdtm/static/env00/36/1.check/restore.chk.log
------------------------ grep Error ------------------------
(00.107255)     36:  `- type 1 ID 0x6
(00.107259)     36:    `- FD 3 pid 36
(00.107264)     36:  `- type 1 ID 0x7
(00.107286)     36: No pagemap-36.img image
(00.107344) Error (criu/cr-restore.c:2453): Restoring FAILED.
------------------------ ERROR OVER ------------------------
################# Test zdtm/static/env00 FAIL at CRIU restore ##################
##################################### FAIL #####################################

The problem is that criu restore tries to open pagemap images
and doesn't work without them. I attached a patch, which shows
places which has to be fixed, but now we need to figure out
how to do this properly.

> 
> zdtm.py run -a --check-only
> 
> Today I spent about one hour and fixed a few problems, but a few  tests
> still fail:
> 
> ################### 10 TEST(S) FAILED (TOTAL 323/SKIPPED 32) ####################
>  * zdtm/static/sigpending(h)
>  * zdtm/static/sit(ns)
>  * zdtm/static/deleted_unix_sock(h)
>  * zdtm/static/zombie00(h)
>  * zdtm/static/unlink_fstat03(h)
>  * zdtm/static/del_standalone_un(h)
>  * zdtm/static/seccomp_strict(h)
>  * zdtm/static/seccomp_filter(h)
>  * zdtm/static/pidns02(uns)
>  * zdtm/transition/fork2
> ##################################### FAIL #####################################
> 
> > 
> > There's a checklist for every new feature: https://criu.org/New_features_checklist
> > Do we have everything (applicable) for the --check-only?
> > 
> > -- Pavel
-------------- next part --------------
diff --git a/criu/mem.c b/criu/mem.c
index 1089270d9..17edb4220 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -816,6 +816,9 @@ static int premap_priv_vmas(struct pstree_item *t, struct vm_area_list *vmas,
 		if (!vma_area_is_private(vma, kdat.task_size))
 			continue;
 
+		if (opts.check_only)
+			continue;
+
 		if (vma->pvma == NULL && pr->pieok && !vma_force_premap(vma, &vmas->h)) {
 			/*
 			 * VMA in question is not shared with anyone. We'll
@@ -860,7 +863,7 @@ static int restore_priv_vma_content(struct pstree_item *t, struct page_read *pr)
 	unsigned long va;
 
 	if (opts.check_only) {
-		pr->close(pr);
+	//	pr->close(pr);
 		return 0;
 	}
 
@@ -1108,19 +1111,21 @@ int prepare_mappings(struct pstree_item *t)
 	rsti(t)->premmapped_len = vmas->priv_size;
 
 	ret = open_page_read(vpid(t), &pr, PR_TASK);
-	if (ret <= 0)
+	if (ret < 0)
 		return -1;
 
 	if (maybe_disable_thp(t, &pr))
 		return -1;
 
-	pr.advance(&pr); /* shift to the 1st iovec */
+	if (!opts.check_only)
+		pr.advance(&pr); /* shift to the 1st iovec */
 
 	ret = premap_priv_vmas(t, vmas, &addr, &pr);
 	if (ret < 0)
 		goto out;
 
-	pr.reset(&pr);
+	if (!opts.check_only)
+		pr.reset(&pr);
 
 	ret = restore_priv_vma_content(t, &pr);
 	if (ret < 0)
diff --git a/criu/shmem.c b/criu/shmem.c
index 013811635..786452a4d 100644
--- a/criu/shmem.c
+++ b/criu/shmem.c
@@ -460,6 +460,9 @@ static int do_restore_shmem_content(void *addr, unsigned long size, unsigned lon
 	int ret = 0;
 	struct page_read pr;
 
+	if (opts.check_only)
+		return 0;
+
 	ret = open_page_read(shmid, &pr, PR_SHMEM);
 	if (ret <= 0)
 		return -1;


More information about the CRIU mailing list