Commit 99b82090 authored by Philip Pronin's avatar Philip Pronin Committed by Dave Watson

ignore non-existent mount points in readHugePageSizes

Summary:
Some of mount points may not exist (for example, if
application is running from chroot and unshare hasn't been used).

@override-unit-failures

Test Plan: unicorn canary

Reviewed By: tudorb@fb.com

FB internal diff: D1311374
parent c2c66129
......@@ -170,16 +170,21 @@ HugePageSizeVec readHugePageSizes() {
if (pos == sizeVec.end() || pos->size != pageSize) {
throw std::runtime_error("Mount page size not found");
}
if (pos->mountPoint.empty()) {
// Store mount point
pos->mountPoint = fs::canonical(fs::path(parts[1].begin(),
parts[1].end()));
struct stat st;
checkUnixError(stat(pos->mountPoint.c_str(), &st),
"stat hugepage mountpoint failed");
pos->device = st.st_dev;
if (!pos->mountPoint.empty()) {
// Only one mount point per page size is allowed
return;
}
// Store mount point
fs::path path(parts[1].begin(), parts[1].end());
struct stat st;
const int ret = stat(path.c_str(), &st);
if (ret == -1 && errno == ENOENT) {
return;
}
checkUnixError(ret, "stat hugepage mountpoint failed");
pos->mountPoint = fs::canonical(path);
pos->device = st.st_dev;
};
return sizeVec;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment