[CRIU] [PATCH] zdtm: check mnt_id in /proc/PID/fdinfo/X
Andrey Vagin
avagin at openvz.org
Wed Apr 23 13:35:43 PDT 2014
Nested mount namespaces should be checked only if fdinfo contains mnt_id
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm.sh | 2 ++
test/zdtm/live/static/mountpoints.c | 14 ++++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 2c222a0..4de131d 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -188,6 +188,8 @@ COMPILE_ONLY=0
BATCH_TEST=0
SPECIFIED_NAME_USED=0
+cat /proc/self/fdinfo/1 | grep -q mnt_id || export ZDTM_NOSUBNS=1
+
zdtm_sep()
{ (
set +x
diff --git a/test/zdtm/live/static/mountpoints.c b/test/zdtm/live/static/mountpoints.c
index 139be7e..65c2eb3 100644
--- a/test/zdtm/live/static/mountpoints.c
+++ b/test/zdtm/live/static/mountpoints.c
@@ -78,7 +78,7 @@ static int test_fn(int argc, char **argv)
struct ns_exec_args args;
bool private = false;
mode_t old_mask;
- pid_t pid;
+ pid_t pid = -1;
if (!getenv("ZDTM_REEXEC")) {
setenv("ZDTM_REEXEC", "1", 0);
@@ -276,10 +276,12 @@ done:
if (fd == -1)
return 1;
- pid = clone(ns_child, args.stack_ptr, CLONE_NEWNS | SIGCHLD, &args);
- if (pid < 0) {
- err("Unable to fork child");
- return 1;
+ if (getenv("ZDTM_NOSUBNS") == NULL) {
+ pid = clone(ns_child, args.stack_ptr, CLONE_NEWNS | SIGCHLD, &args);
+ if (pid < 0) {
+ err("Unable to fork child");
+ return 1;
+ }
}
test_daemon();
@@ -336,7 +338,7 @@ done:
}
}
- {
+ if (pid > 0) {
kill(pid, SIGTERM);
int status = 1;
wait(&status);
--
1.8.5.3
More information about the CRIU
mailing list