Skip to content

fix(block): read mountinfo once for all the binds - #1205

Closed
sapnasingh4852-source wants to merge 2 commits into
urunc-dev:mainfrom
sapnasingh4852-source:fix/1166-mountinfo-once
Closed

sapnasingh4852-source wants to merge 2 commits into
urunc-dev:mainfrom
sapnasingh4852-source:fix/1166-mountinfo-once

Conversation

@sapnasingh4852-source

@sapnasingh4852-source sapnasingh4852-source commented Nov 12, 2026 •

Copy link
Copy Markdown

Description

getBlockVolumes called getMountInfo for 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 (the existing ErrMountpoint / shared-source behaviour per bind is unchanged).

The second commit adds me to .github/contributors.yaml, as the contribution guide asks.

Related issues

#1166 has no label yet, so the PR stays a draft until it is triaged.

How was this tested?

I could not run the e2e suites: this machine is macOS, so the package only builds for linux, and there is no KVM / containerd here to boot a guest.

What I could run:

  • gofmt clean, GOOS=linux go build ./pkg/unikontainers/..., GOOS=linux go vet ./pkg/unikontainers/.
  • TestBlockVolumesShareMountInfoSnapshot: 8 binds whose sources are not mounted, asserts the mount table is read exactly once. Runs under make unittest on linux.
  • BenchmarkBlockVolumesShareMountInfoSnapshot: 32 binds, one parse per call instead of 32.

The refresh branch after unmount needs a real mount, so it is only exercised by e2e, not by the unit test.

Please add ok-to-test so the e2e suites run here; that is the only way I can satisfy the "all tests run" rule from this machine.

LLM usage

Qoder coding agent assisted with the refactor, the test and the PR text. I read the LLM policy and reviewed the diff.

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint) — make lint runs the golangci image and there is no container runtime on this machine.
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl) — not run, see above; waiting for ok-to-test.
  • If LLMs were used: I have read the llm policy.

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>
@netlify

netlify Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

👷 Deploy request for urunc pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 76c6360

@cmainas cmainas added invalid This doesn't seem right do-not-merge labels Nov 12, 2026
@cmainas

cmainas commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

This PR does not follow the contribution guidelines: Please ensure:

  • The PR template is filled correctly.
  • Perform sufficient testing. Building and unit tests is not sufficient.

Fixes: urunc-dev#1166
Signed-off-by: sapnasingh4852-source <sapnasingh4852@gmail.com>
@sapnasingh4852-source
sapnasingh4852-source marked this pull request as draft November 12, 2026 13:19
@sapnasingh4852-source

sapnasingh4852-source commented Nov 12, 2026 •

Copy link
Copy Markdown
Author

added myself to contributors.yaml in 76c6360. also can't run e2e here, macos no kvm. saw invalid just now, i opened this before 1166 got any label. is it going to be triaged?

@sapnasingh4852-source
sapnasingh4852-source deleted the fix/1166-mountinfo-once branch November 20, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getBlockVolumes parses all of mountinfo once per bind mount

2 participants