Blob Blame History Raw
From cc1120addd38d51f38c28fefae669172ba82120d Mon Sep 17 00:00:00 2001
From: Andrei Vagin <avagin@gmail.com>
Date: Wed, 22 Dec 2021 09:59:11 -0800
Subject: [PATCH 096/120] page-xfer: stop waiting for a new command after a
 close command

There is no reason to do that and in case of tls, __recv returns EAGAIN
instead of 0.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
---
 criu/page-xfer.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index 7ff07680f..60c793009 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -50,8 +50,8 @@ static void psi2iovec(struct page_server_iov *ps, struct iovec *iov)
 #define PS_IOV_ADD_F  6
 #define PS_IOV_GET    7
 
-#define PS_IOV_FLUSH	     0x1023
-#define PS_IOV_FLUSH_N_CLOSE 0x1024
+#define PS_IOV_CLOSE	   0x1023
+#define PS_IOV_FORCE_CLOSE 0x1024
 
 #define PS_CMD_BITS 16
 #define PS_CMD_MASK ((1 << PS_CMD_BITS) - 1)
@@ -1223,8 +1223,8 @@ static int page_server_serve(int sk)
 			ret = page_server_add(sk, &pi, flags);
 			break;
 		}
-		case PS_IOV_FLUSH:
-		case PS_IOV_FLUSH_N_CLOSE: {
+		case PS_IOV_CLOSE:
+		case PS_IOV_FORCE_CLOSE: {
 			int32_t status = 0;
 
 			ret = 0;
@@ -1250,7 +1250,9 @@ static int page_server_serve(int sk)
 			break;
 		}
 
-		if (ret || (pi.cmd == PS_IOV_FLUSH_N_CLOSE))
+		if (ret)
+			break;
+		if (pi.cmd == PS_IOV_CLOSE || pi.cmd == PS_IOV_FORCE_CLOSE)
 			break;
 	}
 
@@ -1491,9 +1493,9 @@ int disconnect_from_page_server(void)
 		 * the parent process) so we must order the
 		 * page-server to terminate itself.
 		 */
-		pi.cmd = PS_IOV_FLUSH_N_CLOSE;
+		pi.cmd = PS_IOV_FORCE_CLOSE;
 	else
-		pi.cmd = PS_IOV_FLUSH;
+		pi.cmd = PS_IOV_CLOSE;
 
 	if (send_psi(page_server_sk, &pi))
 		goto out;
-- 
2.34.1