libcontainer/intelrdt: use moby/sys/mountinfo#2606
Merged
mrunalp merged 2 commits intoopencontainers:masterfrom Sep 30, 2020
Merged
libcontainer/intelrdt: use moby/sys/mountinfo#2606mrunalp merged 2 commits intoopencontainers:masterfrom
mrunalp merged 2 commits intoopencontainers:masterfrom
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 <kolyshkin@gmail.com>
Member
|
@Creatone @xiaochenshen PTAL |
Creatone
reviewed
Sep 29, 2020
| 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.
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
Contributor
Author
There was a problem hiding this comment.
Left some comments then decided it's easier to rewrite the code. Hope it's OK with you.
Heavily based on work by Paweł Szulik <pawel.szulik@intel.com> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
|
LGTM |
AkihiroSuda
approved these changes
Sep 29, 2020
Contributor
xiaochenshen
left a comment
There was a problem hiding this comment.
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.
mrunalp
approved these changes
Sep 30, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).