[CRIU] [PATCH 2/3] zdtm: restore ns_last_pid before executing restore in a second time
Andrei Vagin
avagin at openvz.org
Wed Jun 21 08:16:46 MSK 2017
From: Andrei Vagin <avagin at virtuozzo.com>
Otherwise a criu process can get a pid of one of restored processes.
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
test/zdtm.py | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index 4cc73aa..0f7d36f 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -337,12 +337,6 @@ def test_flag(tdesc, flag):
return flag in tdesc.get('flags', '').split()
-def reset_pid(pid = 1):
- fd = open('/proc/sys/kernel/ns_last_pid', 'w')
- fd.write('%s' % pid)
- fd.close()
-
-
#
# Exception thrown when something inside the test goes wrong,
# e.g. test doesn't start, criu returns with non zero code or
@@ -937,6 +931,9 @@ class criu:
os.close(status_fds[0])
return ret
+ if '--check-only' in opts and action == "restore":
+ open("/proc/sys/kernel/ns_last_pid", "w+").write(ns_last_pid)
+
grep_errors(os.path.join(__ddir, log))
if ret != 0:
if self.__fault and int(self.__fault) < 128:
@@ -1075,8 +1072,6 @@ class criu:
if self.__check_only:
self.__criu_act("restore", opts = r_opts + ["--restore-detached"] + ['--check-only'])
- # sometimes the real restore fails with PID conflicts without this
- reset_pid()
self.__criu_act("restore", opts = r_opts + ["--restore-detached"])
--
2.9.4
More information about the CRIU
mailing list