[CRIU] [PATCH] zdtm/socket_aio: add a synchonization between processes

Andrei Vagin avagin at openvz.org
Mon Jan 23 14:36:11 PST 2017


From: Andrei Vagin <avagin at virtuozzo.com>

The test has to do nothing during c/r.

======================= Run zdtm/static/socket_aio in ns =======================
Start test
./socket_aio --pidfile=socket_aio.pid --outfile=socket_aio.out
Run criu dump
Run criu restore
5: Old maps lost: set(["7f0a5188a000-7f0a5188f000 ['rw-p']"])
5: New maps appeared: set(["7f0a51884000-7f0a5188f000 ['rw-p']", "7f0a51883000-7f0a51884000 ['---p']"])
Send the 9 signal to  97
Wait for zdtm/static/socket_aio(97) to die for 0.100000

Reported-by: Mr Jenkins
Signed-off-by: Andrei Vagin <avagin at openvz.org>
---
 test/zdtm/static/socket_aio.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/zdtm/static/socket_aio.c b/test/zdtm/static/socket_aio.c
index 6ca5079..b8966b0 100644
--- a/test/zdtm/static/socket_aio.c
+++ b/test/zdtm/static/socket_aio.c
@@ -32,9 +32,12 @@ int main(int argc, char **argv)
 	pid_t pid;
 	int ret, res;
 	const struct aiocb   *aioary[1];
+	task_waiter_t child_waiter;
 
 	test_init(argc, argv);
 
+	task_waiter_init(&child_waiter);
+
 	if ((fd_s = tcp_init_server(AF_INET, &port)) < 0) {
 		pr_err("initializing server failed\n");
 		return 1;
@@ -65,6 +68,8 @@ int main(int argc, char **argv)
 			return 1;
 		}
 
+		task_waiter_complete_current(&child_waiter);
+
 		/* Wait for request completion */
 		aioary[0] = &aiocb;
 		ret = aio_error(&aiocb);
@@ -109,6 +114,8 @@ again:
 		goto error;
 	}
 
+	task_waiter_wait4(&child_waiter, pid);
+
 	test_daemon();
 	test_waitsig();
 
-- 
2.7.4



More information about the CRIU mailing list