[CRIU] [PATCH 4/8] parasite: exit from parasite code if something failed

Andrey Vagin avagin at openvz.org
Fri Jun 14 07:04:55 EDT 2013


The controll socket is shut down for only writing, because it will wait
FINI command.

https://bugzilla.openvz.org/show_bug.cgi?id=2622

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 pie/parasite.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/pie/parasite.c b/pie/parasite.c
index c54ee39..2570cb4 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -460,10 +460,17 @@ static noinline __used int noinline parasite_daemon(void *args)
 	if (__parasite_daemon_reply_ack(PARASITE_CMD_DAEMONIZE, 0))
 		goto out;
 
+	ret = 0;
+
 	while (1) {
 		if (__parasite_daemon_wait_msg(&m))
 			break;
 
+		if (ret && m.cmd != PARASITE_CMD_FINI) {
+			pr_err("Command rejected\n");
+			continue;
+		}
+
 		switch (m.cmd) {
 		case PARASITE_CMD_FINI:
 			ret = fini();
@@ -513,6 +520,11 @@ static noinline __used int noinline parasite_daemon(void *args)
 
 		if (__parasite_daemon_reply_ack(m.cmd, ret))
 			break;
+
+		if (ret) {
+			pr_err("Close the control socket for writing\n");
+			sys_shutdown(tsock, SHUT_WR);
+		}
 	}
 
 out:
-- 
1.8.2



More information about the CRIU mailing list