[guest] back container bundle with scratch so sandbox mounts are on disk#2835
Open
rawahars wants to merge 2 commits into
Open
[guest] back container bundle with scratch so sandbox mounts are on disk#2835rawahars wants to merge 2 commits into
rawahars wants to merge 2 commits into
Conversation
A `sandbox://` mount is served from a directory under the container bundle, so the bundle must live on the pod scratch disk for the mount to be disk-backed. The v1 shim mounts the scratch disk at the bundle path, so this holds. The v2 shim keeps the bundle on the `UVM tmpfs` and mounts the scratch elsewhere, so `sandbox://` mounts end up on `tmpfs` instead of disk. In the guest, when the scratch dir is not already nested under the bundle, bind a scratch directory onto the bundle before mounting the overlay. The choice is path-based (`bundleNeedsScratchBind`), so both shims share one rule. Unmount the bind in `Container.Delete`, and reorder `releaseResources` so the guest releases the disk-backed mounts before the host detaches the scratch. Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
helsaawy
approved these changes
Jul 21, 2026
Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
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.
A
sandbox://mount is served from a directory under the container bundle, so the bundle must live on the pod scratch disk for the mount to be disk-backed. The v1 shim mounts the scratch disk at the bundle path, so this holds. The v2 shim keeps the bundle on theUVM tmpfsand mounts the scratch elsewhere, sosandbox://mounts end up ontmpfsinstead of disk.In the guest, when the scratch dir is not already nested under the bundle, bind a scratch directory onto the bundle before mounting the overlay. The choice is path-based (
bundleNeedsScratchBind), so both shims share one rule. Unmount the bind inContainer.Delete, and reorderreleaseResourcesso the guest releases the disk-backed mounts before the host detaches the scratch.Manual validation
All of the following were run manually against a live host (v1 =
runhcs-lcow, v2 =runhcs-lcow-v2), verifying thesandbox://mount filesystem viadf /sandboxmountand confirming clean teardown (mounts, dirs, and scratch disk released; noEBUSY).sandbox://backing/dev/sd*(no regression)bundleNeedsScratchBindskips the bind — confirms the path rule leaves working v1 layouts untouched./dev/sd*(fixed)tmpfswith scratch mounted elsewhere, sosandbox://previously landed ontmpfs. The new bind puts the bundle (and thus the mount) on the scratch disk; teardown also verifies bundle/scratch dirs are removed./dev/sd*(new bind)reuse-scratchreuses the sandbox's scratch, so its own bundle sits ontmpfs. The path rule detects the non-nested scratch and binds — the case where v1 newly needs the bind, proving the rule is layout-based rather than shim-based./dev/sd*(fixed)reuse-scratchcontainer on v2; confirms the fix holds when scratch is shared and the bundle is ontmpfs.tenant-sandbox-id)/dev/sd*on every tenanttenant-sandbox-id; each tenant gets its own pod namespace whose bundle is bound to that tenant's scratch, so every tenant'ssandbox://is disk-backed, and removing one tenant leaves the others (and the UVM) intact.Additional cases:
sandbox://mounts on one container — all disk-backed.sandbox-tmp://mount — remainstmpfsas intended (unchanged).sandbox://mount — starts and stops normally.sandbox://mount — succeeds (notnoexec).bundleNeedsScratchBindunit test — passes (Linux/WSL).GOOS=linuxguest build — pass.EBUSYerrors across the full run.