-
Notifications
You must be signed in to change notification settings - Fork 7k
[core] (cgroups) Use /proc/mounts if mount file is missing. #58577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,13 +46,29 @@ | |
|
|
||
| namespace ray { | ||
| Status SysFsCgroupDriver::CheckCgroupv2Enabled() { | ||
| FILE *fp = setmntent(mount_file_path_.c_str(), "r"); | ||
| std::string mount_file_path = mount_file_path_; | ||
|
|
||
| int fd = open(mount_file_path.c_str(), O_RDONLY); | ||
|
|
||
| if (fd == -1) { | ||
| mount_file_path = fallback_mount_file_path_; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a log and print out the error
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call. Here's an example from the test output.
|
||
| RAY_LOG(WARNING) << absl::StrFormat( | ||
| "Failed to open mount fail at %s because of error '%s'. Using fallback mount " | ||
| "file at %s.", | ||
| mount_file_path_, | ||
| strerror(errno), | ||
| fallback_mount_file_path_); | ||
| } else { | ||
| close(fd); | ||
| } | ||
|
|
||
| FILE *fp = setmntent(mount_file_path.c_str(), "r"); | ||
|
|
||
| if (!fp) { | ||
| return Status::Invalid( | ||
| absl::StrFormat("Failed to open mount file at %s. Could not verify that " | ||
| "cgroupv2 was mounted correctly. \n%s", | ||
| mount_file_path_, | ||
| mount_file_path, | ||
| strerror(errno))); | ||
| } | ||
|
|
||
|
|
@@ -71,7 +87,7 @@ Status SysFsCgroupDriver::CheckCgroupv2Enabled() { | |
| return Status::Invalid( | ||
| absl::StrFormat("Failed to parse mount file at %s. Could not verify that " | ||
| "cgroupv2 was mounted correctly.", | ||
| mount_file_path_)); | ||
| mount_file_path)); | ||
| } | ||
|
|
||
| if (found_cgroupv1 && found_cgroupv2) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could potentially add more error handling here (e.g. disambiguating ENOENT from other error codes), but I think it might be overkill.