Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70daa285 authored by T.J. Mercier's avatar T.J. Mercier
Browse files

libprocessgroup: CgroupSetup should fail if a required controller fails to mount

The optional cgroup controller attribute was added in commit 7f19b1e6
("libprocessgroup: introduce optional attribute for cgroup controllers")
but has always caused CgroupSetup to return true even in the case of a
required mount failure. This function should fail in that case, only
returning true for mount failures of optional controllers.

Bug: 401031513
Change-Id: I693a91db2c58adda876f0ed6f8ea123df5a2ec61
parent e0e8d553
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ static bool ActivateV2CgroupController(const CgroupDescriptor& descriptor) {

    if (!Mkdir(controller->path(), descriptor.mode(), descriptor.uid(), descriptor.gid())) {
        LOG(ERROR) << "Failed to create directory for " << controller->name() << " cgroup";
        return false;
        return descriptor.controller()->flags() & CGROUPRC_CONTROLLER_FLAG_OPTIONAL;
    }

    return ::ActivateControllers(controller->path(), {{controller->name(), descriptor}});
@@ -294,8 +294,8 @@ bool CgroupSetup() {
        }

        if (!SetupCgroup(descriptor)) {
            // issue a warning and proceed with the next cgroup
            LOG(WARNING) << "Failed to setup " << name << " cgroup";
            LOG(ERROR) << "Failed to setup " << name << " cgroup";
            return false;
        }
    }