[CRIU] [PATCH 1/3] fault: add ability to fault open_by_handel in check_open_handle
Andrey Vagin
avagin at openvz.org
Wed Mar 16 11:22:09 PDT 2016
From: Andrei Vagin <avagin at openvz.org>
It's required to test irmap cache. I don't know how to force it
without this patch. Each time when a file can be opened by handle,
its path can be resolved via /proc/PID/fd/X.
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
criu/fsnotify.c | 7 +++++++
criu/include/fault-injection.h | 2 ++
test/jenkins/criu-fault.sh | 1 +
test/zdtm.py | 2 +-
4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/criu/fsnotify.c b/criu/fsnotify.c
index 371ab6a..db7f0e6 100644
--- a/criu/fsnotify.c
+++ b/criu/fsnotify.c
@@ -40,6 +40,7 @@
#include "cr_options.h"
#include "namespaces.h"
#include "pstree.h"
+#include "fault-injection.h"
#include "protobuf.h"
#include "images/fsnotify.pb-c.h"
@@ -224,7 +225,13 @@ int check_open_handle(unsigned int s_dev, unsigned long i_ino,
int fd = -1;
char *path;
+ if (fault_injected(FI_CHECK_OPEN_HANDLE)) {
+ fd = -1;
+ goto fault;
+ }
+
fd = open_handle(s_dev, i_ino, f_handle);
+fault:
if (fd >= 0) {
struct mount_info *mi;
diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
index 989f654..202897e 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -6,6 +6,8 @@ enum faults {
FI_NONE = 0,
FI_DUMP_EARLY,
FI_RESTORE_ROOT_ONLY,
+ /* not fatal */
+ FI_CHECK_OPEN_HANDLE = 128,
FI_MAX,
};
diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
index 82f8f73..437757c 100755
--- a/test/jenkins/criu-fault.sh
+++ b/test/jenkins/criu-fault.sh
@@ -4,3 +4,4 @@ source `dirname $0`/criu-lib.sh
prep
./test/zdtm.py run -t zdtm/static/env00 --fault 1 --report report -f h || fail
./test/zdtm.py run -t zdtm/static/unlink_fstat00 --fault 2 --report report -f h || fail
+./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --pre 2 -f uns || fail
diff --git a/test/zdtm.py b/test/zdtm.py
index b523c62..362e1be 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -664,7 +664,7 @@ class criu_cli:
ret = self.__criu(action, s_args, self.__fault, strace, preexec)
grep_errors(os.path.join(__ddir, log))
if ret != 0:
- if self.__fault:
+ if self.__fault and int(self.__fault) < 128:
try_run_hook(self.__test, ["--fault", action])
if action == "dump":
# create a clean directory for images
--
2.5.0
More information about the CRIU
mailing list