]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "Silence cgroups v1 read-only filesystem warning" 18553/head
authorMichal Koutný <mkoutny@suse.com>
Wed, 10 Feb 2021 17:47:13 +0000 (18:47 +0100)
committerMichal Koutný <mkoutny@suse.com>
Thu, 11 Feb 2021 15:59:50 +0000 (16:59 +0100)
PID 1 will now check upfront which v1 controller hiearchies are
available and modifiable and therefore it will not attempt to touch
them. If we get an EROFS failure then, it points to another
inconsistency so we will report it again. The revert also simplifies the
code a bit.

src/core/cgroup.c

index a0d188e1c4c8e7634d47deeb8e522f097937873e..1347e51904164dbe0f10ba712f14b932e76a0020 100644 (file)
@@ -1839,10 +1839,6 @@ int unit_pick_cgroup_path(Unit *u) {
         return 0;
 }
 
-static int cg_v1_errno_to_log_level(int r) {
-        return r == -EROFS ? LOG_DEBUG : LOG_WARNING;
-}
-
 static int unit_update_cgroup(
                 Unit *u,
                 CGroupMask target_mask,
@@ -1900,30 +1896,16 @@ static int unit_update_cgroup(
          * We perform migration also with whole slices for cases when users don't care about leave
          * granularity. Since delegated_mask is subset of target mask, we won't trim slice subtree containing
          * delegated units.
-         *
-         * If we're in an nspawn container and using legacy cgroups, the controller hierarchies are mounted
-         * read-only into the container. We skip migration/trim in this scenario since it would fail
-         * regardless with noisy "Read-only filesystem" warnings.
          */
         if (cg_all_unified() == 0) {
                 r = cg_migrate_v1_controllers(u->manager->cgroup_supported, migrate_mask, u->cgroup_path, migrate_callback, u);
                 if (r < 0)
-                        log_unit_full_errno(
-                                u,
-                                cg_v1_errno_to_log_level(r),
-                                r,
-                                "Failed to migrate controller cgroups from %s, ignoring: %m",
-                                u->cgroup_path);
+                        log_unit_warning_errno(u, r, "Failed to migrate controller cgroups from %s, ignoring: %m", u->cgroup_path);
 
                 is_root_slice = unit_has_name(u, SPECIAL_ROOT_SLICE);
                 r = cg_trim_v1_controllers(u->manager->cgroup_supported, ~target_mask, u->cgroup_path, !is_root_slice);
                 if (r < 0)
-                        log_unit_full_errno(
-                                u,
-                                cg_v1_errno_to_log_level(r),
-                                r,
-                                "Failed to delete controller cgroups %s, ignoring: %m",
-                                u->cgroup_path);
+                        log_unit_warning_errno(u, r, "Failed to delete controller cgroups %s, ignoring: %m", u->cgroup_path);
         }
 
         /* Set attributes */