]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: fix reboots when using dbus 4628/head
authorSerge Hallyn <serge@hallyn.com>
Tue, 23 Dec 2025 19:56:31 +0000 (13:56 -0600)
committerSerge Hallyn <serge@hallyn.com>
Tue, 23 Dec 2025 19:56:31 +0000 (13:56 -0600)
When using dbus on a systemd system, we ask systemd to create a
"scope" for us to run in.  We send a dbus message, and wait
for the reply saying it is created.

When we reboot, we were re-sending the request to create the
scope.  However, the scope still exists, because or single
lxc-monitor (originally lxc-start) thread is still under the
'lxc.pivot' sub-directory of the scope.

But, on reboot, our lxc_conf already has our scope recorded!
So, just check whether that is set, and skip scope creation
if so.

With this patch, i can reboot ad nauseum with no apparent
problems.

We could probably move this check to the top of the function,
but for now this fixes the bug.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
src/lxc/cgroups/cgfsng.c

index eea2b1f6d950a3324c09b158d182641c47816467..81994817c5565a7c675573be700aef0ee3d9d759 100644 (file)
@@ -1521,6 +1521,9 @@ static int unpriv_systemd_create_scope(struct cgroup_ops *ops, struct lxc_conf *
                dbus_threads_initialized = true;
        }
 
+       if (conf->cgroup_meta.systemd_scope != NULL)
+               return log_error(true, "Already in a scope, must be a reboot.");
+
        connection = open_systemd();
        if (connection == NULL)
                return log_error(false, "Failed opening dbus connection");