]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
execute: don't apply journal + oomd xattrs to subcgroup
authorLennart Poettering <lennart@poettering.net>
Mon, 24 Apr 2023 08:05:04 +0000 (10:05 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 27 Apr 2023 10:18:32 +0000 (12:18 +0200)
We don't need to apply the journal/oomd xattrs to the subcgroups we add,
since those daemons already look for the xattrs up the tree anyway.
Hence remove this.

This is in particular relevant as it means later changes to the xattr
don#t need to be replicated on the subcgroup either.

src/core/execute.c

index da7a37c187ead7285a921e0b6b02fd2c34c64e0a..a9e6f7bcae0e40ab1049ac716d3e36cf6ec4fc98 100644 (file)
@@ -5663,15 +5663,13 @@ int exec_spawn(Unit *unit,
                 r = exec_parameters_get_cgroup_path(params, cgroup_context, &subcgroup_path);
                 if (r < 0)
                         return log_unit_error_errno(unit, r, "Failed to acquire subcgroup path: %m");
-                if (r > 0) { /* We are using a child cgroup */
+                if (r > 0) {
+                        /* If there's a subcgroup, then let's create it here now (the main cgroup was already
+                         * realized by the unit logic) */
+
                         r = cg_create(SYSTEMD_CGROUP_CONTROLLER, subcgroup_path);
                         if (r < 0)
                                 return log_unit_error_errno(unit, r, "Failed to create subcgroup '%s': %m", subcgroup_path);
-
-                        /* Normally we would not propagate the xattrs to children but since we created this
-                         * sub-cgroup internally we should do it. */
-                        cgroup_oomd_xattr_apply(unit, subcgroup_path);
-                        cgroup_log_xattr_apply(unit, subcgroup_path);
                 }
         }