cgroups: partial revert of /sys/fs/cgroup/cpuset backport
These older branches don't have osutils.IterateMountPoints, so
revert the change back to using the simpler/dumber _FileContains.
BUG=chromium:883000
TEST=None
Change-Id: I6756a20cf2c760547c7d53f5ab5f71054361e0af
(cherry picked from commit 0588e68ae1ecdac13972accfe415a87a9f6d2b9a)
Reviewed-on: https://chromium-review.googlesource.com/1223775
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/lib/cgroups.py b/lib/cgroups.py
index 6b368b9..664f0e9 100644
--- a/lib/cgroups.py
+++ b/lib/cgroups.py
@@ -115,9 +115,8 @@
return False
def _EnsureMounted(mnt, args):
- for mtab in osutils.IterateMountPoints():
- if mtab.destination == mnt:
- return True
+ if _FileContains('/proc/mounts', [mnt]):
+ return True
# Grab a lock so in the off chance we have multiple programs (like two
# cros_sdk launched in parallel) running this init logic, we don't end
@@ -125,9 +124,8 @@
lock_path = '/tmp/.chromite.cgroups.lock'
with locking.FileLock(lock_path, 'cgroup lock') as lock:
lock.write_lock()
- for mtab in osutils.IterateMountPoints():
- if mtab.destination == mnt:
- return True
+ if _FileContains('/proc/mounts', [mnt]):
+ return True
# Not all distros mount cgroup_root to sysfs.
osutils.SafeMakedirs(mnt, sudo=True)