YARN-6433. Only accessible cgroup mount directories should be selected for a controller. (Miklos Szegedi via kasha)
(cherry picked from commit 8a1d7480f7
)
This commit is contained in:
parent
c411adac32
commit
53da65ef8b
|
@ -236,7 +236,12 @@ class CGroupsHandlerImpl implements CGroupsHandler {
|
||||||
Map<String, List<String>> entries) {
|
Map<String, List<String>> entries) {
|
||||||
for (Map.Entry<String, List<String>> e : entries.entrySet()) {
|
for (Map.Entry<String, List<String>> e : entries.entrySet()) {
|
||||||
if (e.getValue().contains(controller)) {
|
if (e.getValue().contains(controller)) {
|
||||||
return e.getKey();
|
if (new File(e.getKey()).canRead()) {
|
||||||
|
return e.getKey();
|
||||||
|
} else {
|
||||||
|
LOG.warn(String.format(
|
||||||
|
"Skipping inaccessible cgroup mount point %s", e.getKey()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,10 @@ public class TestCGroupsHandlerImpl {
|
||||||
String cpuMtabContent =
|
String cpuMtabContent =
|
||||||
"none " + parentDir.getAbsolutePath()
|
"none " + parentDir.getAbsolutePath()
|
||||||
+ "/cpu cgroup rw,relatime,cpu 0 0\n";
|
+ "/cpu cgroup rw,relatime,cpu 0 0\n";
|
||||||
|
// Mark an empty directory called 'cp' cgroup. It is processed before 'cpu'
|
||||||
|
String cpuMtabContentMissing =
|
||||||
|
"none " + parentDir.getAbsolutePath()
|
||||||
|
+ "/cp cgroup rw,relatime,cpu 0 0\n";
|
||||||
String blkioMtabContent =
|
String blkioMtabContent =
|
||||||
"none " + parentDir.getAbsolutePath()
|
"none " + parentDir.getAbsolutePath()
|
||||||
+ "/blkio cgroup rw,relatime,blkio 0 0\n";
|
+ "/blkio cgroup rw,relatime,blkio 0 0\n";
|
||||||
|
@ -264,6 +268,7 @@ public class TestCGroupsHandlerImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FileWriter mtabWriter = new FileWriter(mockMtab.getAbsoluteFile());
|
FileWriter mtabWriter = new FileWriter(mockMtab.getAbsoluteFile());
|
||||||
|
mtabWriter.write(cpuMtabContentMissing);
|
||||||
mtabWriter.write(cpuMtabContent);
|
mtabWriter.write(cpuMtabContent);
|
||||||
mtabWriter.write(blkioMtabContent);
|
mtabWriter.write(blkioMtabContent);
|
||||||
mtabWriter.close();
|
mtabWriter.close();
|
||||||
|
|
Loading…
Reference in New Issue