[CRIU] [PATCH 3/4] fault: check link_remaps if the restore fails at the last moment

Andrei Vagin avagin at openvz.org
Tue Dec 13 15:58:13 PST 2016


From: Andrei Vagin <avagin at virtuozzo.com>

link-remap files has to be deleted only if processes have been
restored successfully. Otherwise we can want to repeat an attempt,
but it is imposible if some link-remap files were deleted.

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

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index c73b7c7..7ff92be 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1911,6 +1911,9 @@ static int restore_root_task(struct pstree_item *init)
 	if (ret < 0)
 		goto out_kill;
 
+	if (fault_injected(FI_POST_RESTORE))
+		goto out_kill;
+
 	ret = run_scripts(ACT_POST_RESTORE);
 	if (ret != 0) {
 		pr_err("Aborting restore due to post-restore script ret code %d\n", ret);
diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
index e808d19..16a1e6d 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -9,6 +9,7 @@ enum faults {
 	FI_DUMP_PAGES,
 	FI_RESTORE_OPEN_LINK_REMAP,
 	FI_PARASITE_CONNECT,
+	FI_POST_RESTORE,
 	/* 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 83e20b9..ab6c6c7 100755
--- a/test/jenkins/criu-fault.sh
+++ b/test/jenkins/criu-fault.sh
@@ -13,4 +13,8 @@ prep
 ./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --keep-going --report report || fail
 ./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --keep-going --report report || fail
 
+./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 6 --report report || fail
+./test/zdtm.py run -t zdtm/static/mntns_link_remap --fault 6 --report report || fail
+./test/zdtm.py run -t zdtm/static/unlink_fstat03 --fault 6 --report report || fail
+
 ./test/zdtm.py run -t zdtm/static/env00 --fault 5 --keep-going --report report || fail
-- 
2.7.4



More information about the CRIU mailing list