-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
libcontainer/intelrdt: use moby/sys/mountinfo #2606
Conversation
It might be a tad slower but it surely more correct and well maintained, so it's better to use it than rely on a custom implementation which is kind of hard to get entirely right. Signed-off-by: Kir Kolyshkin <[email protected]>
@Creatone @xiaochenshen PTAL |
fields := strings.Split(text, " ") | ||
// Safe as mountinfo encodes mountpoints with spaces as \040. | ||
index := strings.Index(text, " - ") | ||
postSeparatorFields := strings.Fields(text[index+3:]) |
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 was working with this code because there was a possibility of accessing elements that not exist and that could cause a panic error.
Thanks, @kolyshkin for fixing it and improve code readability.
I adjusted the unit tests to your code. Could you consider using them?
kolyshkin/runc@intel-rdt...Creatone:creatone/intelrdt-moby-sys-mountinfo
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.
Left some comments then decided it's easier to rewrite the code. Hope it's OK with you.
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'm fine with this 👍
Heavily based on work by Paweł Szulik <[email protected]> Signed-off-by: Kir Kolyshkin <[email protected]>
LGTM |
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.
LGTM.
I have run some mount/umount test cases today. It works well and no functional change found.
Thank you @kolyshkin @Creatone for fixing and enhancement for Intel RDT.
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.
LGTM
It might be a tad slower but it surely more correct and well maintained,
so it's better to use it than rely on a custom implementation which is
kind of hard to get entirely right.
This (together with / after) #2599 removes the last custom mountinfo
parser from the codebase (we had five of those).