[lxc-devel] [lxc/master] c/r: drop in-flight connections during CRIU dump

adrianreber on Github lxc-bot at linuxcontainers.org
Mon Jul 4 16:08:00 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 819 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160704/cba95591/attachment.bin>
-------------- next part --------------
From ff5fee14f4cae14e1ef49b69a889a3ed81e89bab Mon Sep 17 00:00:00 2001
From: Adrian Reber <areber at redhat.com>
Date: Mon, 4 Jul 2016 16:58:09 +0200
Subject: [PATCH] c/r: drop in-flight connections during CRIU dump

Shortly after CRIU 2.3 has been released a patch has been added to skip
in-flight TCP connections. In-flight connections are not completely
established connections (SYN, SYN-ACK). Skipping in-flight TCP
connections means that the client has to re-initiate the connection
establishment.

This patch stores the CRIU version detected during version check, so
that during dump/checkpoint options can be dynamically enabled depending
on the available CRIU version.

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 src/lxc/criu.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index a1b7d40..8677655 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -50,6 +50,10 @@
 #define CRIU_GITID_VERSION	"2.0"
 #define CRIU_GITID_PATCHLEVEL	0
 
+#define CRIU_IN_FLIGHT_SUPPORT	240
+
+static int criu_version;
+
 lxc_log_define(lxc_criu, lxc);
 
 struct criu_opts {
@@ -256,6 +260,10 @@ static void exec_criu(struct criu_opts *opts)
 		if (ret < 0 || ret >= sizeof(log))
 			goto err;
 
+		if (criu_version >= CRIU_IN_FLIGHT_SUPPORT) {
+			DECLARE_ARG("--skip-in-flight");
+		}
+
 		DECLARE_ARG("--freeze-cgroup");
 		DECLARE_ARG(log);
 
@@ -458,8 +466,12 @@ static bool criu_version_ok()
 		if (fgetc(f) != '\n')
 			goto version_error;
 
-		if (strcmp(version, CRIU_VERSION) >= 0)
+		if (strcmp(version, CRIU_VERSION) >= 0) {
+			float tmp = 0;
+			sscanf(version, "%f", &tmp);
+			criu_version = (int)(tmp*100);
 			goto version_match;
+		}
 
 		if (fscanf(f, "GitID: v%1023[^-]s", version) != 1)
 			goto version_error;


More information about the lxc-devel mailing list