[CRIU] [PATCH] zdtm:mntns_open: wait when a child process opens descriptors

Andrey Vagin avagin at openvz.org
Mon Dec 21 13:35:20 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 test/zdtm/live/static/mntns_open.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/zdtm/live/static/mntns_open.c b/test/zdtm/live/static/mntns_open.c
index 99c2209..3ddfa76 100644
--- a/test/zdtm/live/static/mntns_open.c
+++ b/test/zdtm/live/static/mntns_open.c
@@ -58,6 +58,8 @@ static int get_mntid(int fd)
 	return mnt_id;
 }
 
+task_waiter_t t;
+
 int ns_child(void *_arg)
 {
 	struct ns_exec_args *args = _arg;
@@ -65,6 +67,7 @@ int ns_child(void *_arg)
 	int id1, id2;
 
 	fd2 = open(fpath, O_RDWR);
+	task_waiter_complete(&t, 1);
 	test_waitsig();
 
 	id1 = get_mntid(args->fd);
@@ -87,6 +90,8 @@ int main(int argc, char **argv)
 
 	test_init(argc, argv);
 
+	task_waiter_init(&t);
+
 	snprintf(fpath, sizeof(fpath), "%s/%s", dirname, MPTS_FILE);
 	if (mkdir(dirname, 0600) < 0) {
 		fail("Can't make zdtm_sys");
@@ -109,10 +114,11 @@ int main(int argc, char **argv)
 		close(args.fd);
 	}
 
+	task_waiter_wait4(&t, 1);
+
 	test_daemon();
 	test_waitsig();
 
-
 	if (pid > 0) {
 		kill(pid, SIGTERM);
 		int status = 1;
-- 
2.4.3



More information about the CRIU mailing list