]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/cgroup: fix error handling of cg_remove_xattr()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 4 Aug 2021 18:13:48 +0000 (03:13 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 4 Aug 2021 18:13:48 +0000 (03:13 +0900)
src/core/cgroup.c

index e5fd6672bb3482d6cdf97e9555497e20746f0870..83bd97327d7754fa4f7b1a7d6e1d501a9c6b6b0f 100644 (file)
@@ -717,13 +717,13 @@ void cgroup_oomd_xattr_apply(Unit *u, const char *cgroup_path) {
 
         if (c->moom_preference != MANAGED_OOM_PREFERENCE_AVOID) {
                 r = cg_remove_xattr(SYSTEMD_CGROUP_CONTROLLER, cgroup_path, "user.oomd_avoid");
-                if (r != -ENODATA)
+                if (r < 0 && r != -ENODATA)
                         log_unit_debug_errno(u, r, "Failed to remove oomd_avoid flag on control group %s, ignoring: %m", cgroup_path);
         }
 
         if (c->moom_preference != MANAGED_OOM_PREFERENCE_OMIT) {
                 r = cg_remove_xattr(SYSTEMD_CGROUP_CONTROLLER, cgroup_path, "user.oomd_omit");
-                if (r != -ENODATA)
+                if (r < 0 && r != -ENODATA)
                         log_unit_debug_errno(u, r, "Failed to remove oomd_omit flag on control group %s, ignoring: %m", cgroup_path);
         }
 }
@@ -755,7 +755,7 @@ static void cgroup_xattr_apply(Unit *u) {
                         log_unit_debug_errno(u, r, "Failed to set delegate flag on control group %s, ignoring: %m", u->cgroup_path);
         } else {
                 r = cg_remove_xattr(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, "trusted.delegate");
-                if (r != -ENODATA)
+                if (r < 0 && r != -ENODATA)
                         log_unit_debug_errno(u, r, "Failed to remove delegate flag on control group %s, ignoring: %m", u->cgroup_path);
         }