The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3414

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
When a newer lxc library communicates with an older one
(such as running an lxc 4.0 lxc-freeze on a longer running
container which was started while lxc was still at version
3), the LXC_CMD_GET_LIMITING_CGROUP command is not
available, causing the remote to just close the socket.
Catch this and try the previous command instead.

Signed-off-by: Wolfgang Bumiller <w.bumil...@proxmox.com>
From 400d579e69f5f41a14d9fd0617f0e4972ae53dcf Mon Sep 17 00:00:00 2001
From: Wolfgang Bumiller <w.bumil...@proxmox.com>
Date: Fri, 15 May 2020 16:33:34 +0200
Subject: [PATCH] improve LXC_CMD_GET_CGROUP compatibility

When a newer lxc library communicates with an older one
(such as running an lxc 4.0 lxc-freeze on a longer running
container which was started while lxc was still at version
3), the LXC_CMD_GET_LIMITING_CGROUP command is not
available, causing the remote to just close the socket.
Catch this and try the previous command instead.

Signed-off-by: Wolfgang Bumiller <w.bumil...@proxmox.com>
---
 src/lxc/commands.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/lxc/commands.c b/src/lxc/commands.c
index 6309f68e02..25c409e3bc 100644
--- a/src/lxc/commands.c
+++ b/src/lxc/commands.c
@@ -509,8 +509,21 @@ static char *lxc_cmd_get_cgroup_path_do(const char *name, 
const char *lxcpath,
        if (ret < 0)
                return NULL;
 
-       if (ret == 0)
+       if (ret == 0) {
+               if (command == LXC_CMD_GET_LIMITING_CGROUP) {
+                       /*
+                        * This may indicate that the container was started
+                        * under an ealier version before
+                        * `cgroup_advanced_isolation` as implemented, there
+                        * it sees an unknown command and just closes the
+                        * socket, sending us an EOF.
+                        */
+                       return lxc_cmd_get_cgroup_path_do(name, lxcpath,
+                                                         subsystem,
+                                                         LXC_CMD_GET_CGROUP);
+               }
                return NULL;
+       }
 
        if (cmd.rsp.ret < 0 || cmd.rsp.datalen < 0)
                return NULL;
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to