Repository navigation
fix(block): read mountinfo once for all the binds - #1205
Open
sapnasingh4852-source wants to merge 1 commit into
Open
sapnasingh4852-source wants to merge 1 commit into
sapnasingh4852-source wants to merge 1 commit into
Conversation
getBlockVolumes called getMountInfo for every bind mount, and each call re-read and re-parsed /proc/thread-self/mountinfo. Resolve every bind against one snapshot instead, and refresh that snapshot after an unmount since unmounting a source changes the table the next lookup needs. Signed-off-by: sapnasingh4852-source <sapnasingh4852@gmail.com>
👷 Deploy request for urunc pending review.Visit the deploys page to approve it
|
Contributor
|
This PR does not follow the contribution guidelines: Please ensure:
|
This branch has not been deployed
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.
Description
getBlockVolumescalledgetMountInfofor every bind mount, and every call re-read and re-parsed/proc/thread-self/mountinfo. With N binds that is N reads of the same file before anything changes.This resolves all the binds against one snapshot of the mount table. The snapshot is refreshed right after an unmount, because unmounting a source changes the table and the following lookups have to see that change (this keeps the existing
ErrMountpoint/ shared-source behaviour per bind).Related issues
How was this tested?
GOOS=linux go build ./pkg/unikontainers/...andGOOS=linux go vet ./pkg/unikontainers/pass (local machine is darwin, so the package can only be built for linux here).TestBlockVolumesShareMountInfoSnapshot, which passes 8 binds whose sources are not mounted and asserts the mount table is read exactly once. It runs on linux in CI.BenchmarkBlockVolumesShareMountInfoSnapshot, which keeps the read/parse cost inside the measured loop so the saving is visible: 32 binds now pay for one parse instead of 32.LLM usage
Qoder (agent) helped with the refactor and the test; I reviewed the diff.