perf(tfork): inject source files while frozen - #13
Open
yiying-zhang wants to merge 70 commits into
Open
Conversation
Stabilize live tfork source freezing
…-main Stabilize single-copy tfork clone path
Rewrite tclone setup for Gensee Crate
Clarify Gensee tclone host setup
Initialize temporary CRIU process UIDs
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.
What this changes
This PR adds a repeatable live-clone option:
It rotates small files in the live source after clone filesystem snapshots have
been created. Children therefore retain the pre-rotation filesystem state while
the source resumes with the new files.
The option is intended for source-side credential or context rotation. A
successfully committed rotation is durable: if later clone publication fails,
Podman rolls back the unpublished children but deliberately does not overwrite
files that the live source may already have observed.
Ordering and commit semantics
When source injection is requested, Podman now:
source;
directory;
The normal no-injection path still thaws at CRIU's
source-detachedevent. Onlysource-rotation requests defer that early thaw until restore and rotation finish.
The rotation commit is the side effect's explicit point of no return:
files, remove newly created destinations, and remove staging files;
unpublished clones, and annotate the returned error to say that the source
rotation was not rolled back.
Rolling the files back after source thaw would be unsafe because the live source
may already have read or modified them.
Atomic installation
All host sources are opened with
O_NOFOLLOW, validated as regular files nolarger than 1 MiB, and read completely before source mutation begins. Duplicate
container destinations are rejected.
For each destination, Podman securely opens the parent beneath
/proc/<source-pid>/root, writes a same-directory temporary file, and then usesrenameatto install it. Existing files are first renamed to private backups sothe complete batch can be restored in reverse order if any commit step fails.
This prevents the source from being thawed with a truncated file, a partial
copy, or only part of a multi-file rotation. Existing destination ownership is
preserved; newly created files inherit Podman's filesystem UID/GID; all installed
files use mode
0600.The batch is failure-atomic for errors handled by Podman. It is not a filesystem
transaction that is crash-atomic across multiple destination directories.
Performance impact
Forks without
--tfork-inject-source-filekeep the existing early-thaw fastpath unchanged.
When rotation is requested, source pause time additionally includes the tail of
CRIU restore plus staging and renaming the requested files. Payloads remain
limited to 1 MiB each, and host reads occur before the source is frozen.
Validation
removal of newly created files, and cleanup of temporary/backup files;
go test ./cmd/podman/containers ./pkg/domain/infra/abi;go vet ./cmd/podman/containers ./pkg/domain/infra/abi;process validation and no D-state leakage after a readiness timeout.