Repository navigation
gofer: do not stat cached regular files during PrepareSave by default - #16479
Merged
Merged
Conversation
During PrepareSave, the gofer filesystem refreshes metadata for each cached regular file when cached metadata is not authoritative (e.g. shared mounts). This was done to populate file size and mtime for validation during restore. runsc never enables this validation, so these sequential stat calls while the sandbox is paused add unnecessary latency. Add PrepareSaveOptions to vfs and gate the stat calls behind ValidateMetadata (off by default). Plumb the option through the kernel. Signed-off-by: darsh <darshanravichandran07@gmail.com>
copybara-service
Bot
force-pushed
the
test/cl1007745122
branch
from
October 27, 2026 04:57
41b943f to
e9b9b36
Compare
…ave-stat PiperOrigin-RevId: 1007824590
copybara-service
Bot
force-pushed
the
test/cl1007745122
branch
from
October 27, 2026 05:45
e9b9b36 to
8229bcb
Compare
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.
gofer: do not stat cached regular files during PrepareSave by default
The problem ? , refer #16208
When you run
runsc checkpoint, gVisor pauses the container to save its state.On shared mounts, gVisor was calling
staton every single cached file one by one. Eachstatcall sends a message to the host and waits for an answer.This metadata was only collected to check file sizes and edit times on restore. But
runscnever turns on this check by default.If a container has thousands of files (like
node_modulesor Python packages), the container was frozen for seconds just doing uselessstatcalls.My suggestion
We skip these
statcalls during save by default.We add an option called
ValidateMetadata(set tofalseby default). Now, gVisor only callsstatif the user explicitly asks for it with--validate-metadata.Code change
In
pkg/sentry/fsimpl/gofer/save_restore.go:Stats
statCalls (Before)statCalls (Now)Added unit tests in
pkg/sentry/vfs/save_restore_test.goto test that options pass correctly.Added test and benchmark in
pkg/sentry/fsimpl/gofer/gofer_test.gofixes #16208
FUTURE_COPYBARA_INTEGRATE_REVIEW=#16346 from DARSHANR007:issue-16208/gofer-preparesave-stat fced933