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

Andrey Vagin avagin at openvz.org
Wed Jun 15 10:59:48 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

v2: reuse FI_RESTORE_ROOT_ONLY
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/cr-restore.c              | 6 ++++++
 criu/include/fault-injection.h | 5 +++++
 test/jenkins/criu-fault.sh     | 3 ++-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index ec6e459..984dbfe 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1732,6 +1732,12 @@ static int restore_root_task(struct pstree_item *init)
 	if (ret < 0)
 		goto out_kill;
 
+	if (fault_injected(FI_CLEAN_REMAPS_WITH_MNTNS)) {
+		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..3b5a2cd 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -5,8 +5,13 @@
 enum faults {
 	FI_NONE = 0,
 	FI_DUMP_EARLY,
+	/*
+	 * FI_RESTORE_ROOT_ONLY can be used to check cleaning ghost
+	 * files before populating mount namespaces
+	 */
 	FI_RESTORE_ROOT_ONLY,
 	FI_DUMP_PAGES,
+	FI_CLEAN_REMAPS_WITH_MNTNS,	/* 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 113d47d..1e645e5 100755
--- a/test/jenkins/criu-fault.sh
+++ b/test/jenkins/criu-fault.sh
@@ -4,8 +4,9 @@ set -e
 source `dirname $0`/criu-lib.sh
 prep
 ./test/zdtm.py run -t zdtm/static/env00 --fault 1 --keep-going --report report -f h || fail
-./test/zdtm.py run -t zdtm/static/unlink_fstat00 --fault 2 --keep-going --report report -f h || fail
 ./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --keep-going --report report -f h || fail
 ./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 2 || fail
+./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 || fail
-- 
2.7.4



More information about the CRIU mailing list