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

Andrey Vagin avagin at openvz.org
Fri Jul 15 14:31:48 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/files-reg.c               | 6 ++++++
 criu/include/fault-injection.h | 1 +
 test/jenkins/criu-fault.sh     | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/criu/files-reg.c b/criu/files-reg.c
index 67d1b6c..2b7a211 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -27,6 +27,7 @@
 #include "namespaces.h"
 #include "proc_parse.h"
 #include "pstree.h"
+#include "fault-injection.h"
 
 #include "protobuf.h"
 #include "images/regfile.pb-c.h"
@@ -1396,6 +1397,11 @@ int open_path(struct file_desc *d,
 	}
 
 	if (rfi->remap) {
+		if (fault_injected(FI_RESTORE_OPEN_LINK_REMAP)) {
+			pr_info("fault: Open link-remap failure!\n");
+			BUG();
+		}
+
 		mutex_lock(ghost_file_mutex);
 		if (rfi->remap->is_dir) {
 			/*
diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
index f1e5c72..02c8457 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -7,6 +7,7 @@ enum faults {
 	FI_DUMP_EARLY,
 	FI_RESTORE_ROOT_ONLY,
 	FI_DUMP_PAGES,
+	FI_RESTORE_OPEN_LINK_REMAP,
 	/* 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..3ce7a40 100755
--- a/test/jenkins/criu-fault.sh
+++ b/test/jenkins/criu-fault.sh
@@ -9,3 +9,6 @@ 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 2 --keep-going --report report || fail
+./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --keep-going --report report || fail
-- 
2.7.4



More information about the CRIU mailing list