Commit 08960eb1 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: check mnt_id in /proc/PID/fdinfo/X

Nested mount namespaces should be checked only if fdinfo contains mnt_id
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent d4e4e577
...@@ -188,6 +188,8 @@ COMPILE_ONLY=0 ...@@ -188,6 +188,8 @@ COMPILE_ONLY=0
BATCH_TEST=0 BATCH_TEST=0
SPECIFIED_NAME_USED=0 SPECIFIED_NAME_USED=0
cat /proc/self/fdinfo/1 | grep -q mnt_id || export ZDTM_NOSUBNS=1
zdtm_sep() zdtm_sep()
{ ( { (
set +x set +x
......
...@@ -78,7 +78,7 @@ static int test_fn(int argc, char **argv) ...@@ -78,7 +78,7 @@ static int test_fn(int argc, char **argv)
struct ns_exec_args args; struct ns_exec_args args;
bool private = false; bool private = false;
mode_t old_mask; mode_t old_mask;
pid_t pid; pid_t pid = -1;
if (!getenv("ZDTM_REEXEC")) { if (!getenv("ZDTM_REEXEC")) {
setenv("ZDTM_REEXEC", "1", 0); setenv("ZDTM_REEXEC", "1", 0);
...@@ -276,10 +276,12 @@ done: ...@@ -276,10 +276,12 @@ done:
if (fd == -1) if (fd == -1)
return 1; return 1;
pid = clone(ns_child, args.stack_ptr, CLONE_NEWNS | SIGCHLD, &args); if (getenv("ZDTM_NOSUBNS") == NULL) {
if (pid < 0) { pid = clone(ns_child, args.stack_ptr, CLONE_NEWNS | SIGCHLD, &args);
err("Unable to fork child"); if (pid < 0) {
return 1; err("Unable to fork child");
return 1;
}
} }
test_daemon(); test_daemon();
...@@ -336,7 +338,7 @@ done: ...@@ -336,7 +338,7 @@ done:
} }
} }
{ if (pid > 0) {
kill(pid, SIGTERM); kill(pid, SIGTERM);
int status = 1; int status = 1;
wait(&status); wait(&status);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment