[CRIU] [PATCH 3/5] criu: check that ghost files are cleaned up in error cases

Andrey Vagin avagin at openvz.org
Wed May 11 13:37:05 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/cr-restore.c              | 11 +++++++++++
 criu/include/fault-injection.h |  2 ++
 test/jenkins/criu-fault.sh     |  2 ++
 3 files changed, 15 insertions(+)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index f115c1f..2f7c492 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1701,6 +1701,11 @@ static int restore_task_with_children(void *_arg)
 		if (root_prepare_shared())
 			goto err;
 
+		if (fault_injected(FI_CLEAN_REMAPS)) {
+			pr_info("fault: check cleaning remaps\n");
+			goto err;
+		}
+
 		if (restore_finish_stage(CR_STATE_RESTORE_SHARED) < 0)
 			goto err;
 	}
@@ -2116,6 +2121,12 @@ static int restore_root_task(struct pstree_item *init)
 	if (ret < 0)
 		goto out_kill;
 
+	if (fault_injected(FI_CLEAN_REMAPS2)) {
+		pr_info("fault: check cleaning remaps\n");
+		ret = -1;
+		goto out_kill;
+	}
+
 	timing_stop(TIME_FORK);
 
 	ret = restore_switch_stage(CR_STATE_RESTORE);
diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
index f1e5c72..1861702 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -7,6 +7,8 @@ enum faults {
 	FI_DUMP_EARLY,
 	FI_RESTORE_ROOT_ONLY,
 	FI_DUMP_PAGES,
+	FI_CLEAN_REMAPS,	/* before creating mount namespaces */
+	FI_CLEAN_REMAPS2,	/* after creating mount namespaces */
 	/* not fatal */
 	FI_CHECK_OPEN_HANDLE = 128,
 	FI_NO_MEMFD = 129,
diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
index 6a55aac..1ae51c6 100755
--- a/test/jenkins/criu-fault.sh
+++ b/test/jenkins/criu-fault.sh
@@ -8,3 +8,5 @@ prep
 ./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail
 ./test/zdtm.py run -t zdtm/static/env00 --fault 129 -f uns || fail
 ./test/zdtm.py run -t zdtm/transition/fork --fault 130 -f h || fail
+./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 5 || fail
+./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 || fail
-- 
2.7.4



More information about the CRIU mailing list