]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/cgroup: allow setting oomd xattrs from user manager
authorNick Rosbrook <nick.rosbrook@canonical.com>
Tue, 14 Jun 2022 19:25:50 +0000 (15:25 -0400)
committerNick Rosbrook <nick.rosbrook@canonical.com>
Fri, 26 Aug 2022 16:40:58 +0000 (12:40 -0400)
The extended attributes 'user.oomd_avoid' and 'user.oomd_omit' are used
to store the setting of the ManagedOOMPrefernce property. Since these
are user extended attributes, the access permissions are defined by the
file permissions, and there is no need to guard this from user managers.

src/core/cgroup.c

index 746c7cdfed0a87cd1c85644cffdf043833ebc93d..c945f76abc387d6124b1431e35e57f47a5665ab3 100644 (file)
@@ -783,6 +783,9 @@ static void cgroup_xattr_apply(Unit *u) {
 
         assert(u);
 
+        /* The 'user.*' xattrs can be set from a user manager. */
+        cgroup_oomd_xattr_apply(u, u->cgroup_path);
+
         if (!MANAGER_IS_SYSTEM(u->manager))
                 return;
 
@@ -809,8 +812,6 @@ static void cgroup_xattr_apply(Unit *u) {
                 else
                         unit_remove_xattr_graceful(u, NULL, xn);
         }
-
-        cgroup_oomd_xattr_apply(u, u->cgroup_path);
 }
 
 static int lookup_block_device(const char *p, dev_t *ret) {