Repository navigation
test/syscalls,g3doc: add journaled overlay test variants and user guide - #17153
Draft
manninglucas wants to merge 1 commit into
Draft
manninglucas wants to merge 1 commit into
manninglucas wants to merge 1 commit into
Conversation
manninglucas
force-pushed
the
lucasmanning/tmpfs-journal-poc
branch
from
November 7, 2026 00:12
74c12d9 to
bedd3e4
Compare
Collaborator
|
cc: @ayushr2 we chat about the journaling, and you may have some experience on it |
manninglucas
force-pushed
the
lucasmanning/tmpfs-journal-poc
branch
4 times, most recently
from
November 12, 2026 22:30
543a133 to
0d27653
Compare
Collaborator
|
What is the impetus for this? I understand the benefit but curious who's asking for this feature. |
Contributor
Author
|
@EtiennePerot there's interest from those running large RL-style workflows to have smoother recovery when there's a sandbox crash. They don't need to recover application state, but they want the filesystem to at least have all their changes from "boot" up until when the crash happened. This way they can tell agents "sorry your computer crashed, but all your files are still in place, please continue where you left off" when crashes happen during training. |
manninglucas
force-pushed
the
lucasmanning/tmpfs-journal-poc
branch
from
November 13, 2026 00:04
0d27653 to
c4318bf
Compare
Add the --journaled-overlay test runner mode and add_journaled_overlay Starlark parameter (enabled on mmap_test and utimes_test), and document journaling rootfs uppers alongside checkpoint/restore, filesystem snapshots, and rootfs tar snapshots.
manninglucas
force-pushed
the
lucasmanning/tmpfs-journal-poc
branch
from
November 13, 2026 01:52
c4318bf to
d6eead7
Compare
manninglucas
changed the base branch from
master
to
lucasmanning/tmpfs-journal-20-boot-restore
November 13, 2026 01:53
This was referenced Nov 13, 2026
This was referenced Nov 13, 2026
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.
Add the --journaled-overlay test runner mode and add_journaled_overlay
Starlark parameter (enabled on mmap_test and utimes_test), and document
journaling rootfs uppers alongside checkpoint/restore, filesystem
snapshots, and rootfs tar snapshots.
Stack
pgalloc: support adopting existing pages and unsaved reservations(+531 / -3)tmpfs/journal: add journal header format, Create, and Close(+510 / -0)tmpfs/journal: add Open header validation and page adoption(+331 / -5)tmpfs/journal: add record schema, State types, and SnapshotSizer(+289 / -17)tmpfs/journal: add binary record encoding and Snapshot writer(+493 / -7)tmpfs/journal: decode and replay snapshot records(+487 / -3)tmpfs/journal: add live mutation writers and delta replay(+469 / -2)tmpfs/journal: add incomplete journal state and recovery/validation tests(+445 / -0)tmpfs/journal: expose FilestoreEnd high-water mark for shrinking(+321 / -2)tmpfs: rebuild filesystem state from a replayed journal(+452 / -1)tmpfs: add journal snapshot compaction and release lifecycle(+444 / -43)tmpfs: journal live namespace, inode, and extent mutations(+398 / -3)tmpfs: add background compactor, save/restore hooks, and self-whiteout sync(+258 / -1)tmpfs,overlay: support activating journaling on populated filesystems(+492 / -1)runsc/config: add journaling rootfs upper flags and policy enums(+161 / -0)runsc/specutils: add journaling rootfs upper annotations and resolution(+401 / -2)runsc/container: manage, lock, and shrink journaled rootfs filestores(+403 / -7)runsc/boot: wire fresh and imported journaling rootfs uppers(+483 / -43)runsc/boot: activate journaling uppers populated by tar or fs-restore(+500 / -4)runsc/boot: activate journaling uppers on checkpoint restore(+516 / -2)test/syscalls,g3doc: add journaled overlay test variants and user guide(+195 / -2) (this PR)Full Stack Overview
Adds metadata journaling for a container's file-backed rootfs overlay upper
tmpfslayer (--journaling-rootfs-upperand--journaling-rootfs-upper-import), storing both the metadata journal and regular-file data pages in the single rootfs upper filestorepgalloc.MemoryFileso a new sandbox can rebuild the upper layer after a sentry crash (SIGKILL/ panic) or clean stop without copying file data.How it works
pkg/sentry/pgalloc,pkg/sentry/fsimpl/tmpfs/journal): Page 0 of the backing filestore holds a 4 KiB journal header (build ID, image ID, active generation/flags,filestoreEndhigh-water mark, and two region descriptors). Two dynamically sized journal regions are allocated in the samepgalloc.MemoryFilevia unsaved page reservations (ClaimFirstPageUnsaved,AllocateUnsaved,FreeUnsaved), which are excluded from memory accounting and checkpointSaveTometadata.pkg/sentry/fsimpl/tmpfs):tmpfsappends records to aMAP_SHAREDmapping of the active region for namespace, attribute, xattr/ACL, and regular-file extent mutations. Records that drop extents are appended before pages are freed. Compaction writes a snapshot to the inactive region (relocating/growing it if needed) and flips the active region with one atomic generation store, and is stopped acrossPrepareSaveandBeforeResumeso it never mutatesMemoryFileduringSaveTo.journal.Openstops at the first torn tail record, verifies directory tree reachability and extent disjointness, and callsMemoryFile.AdoptExistingto adopt referenced data extents in place while punching holes over unused ranges so free pages remain zeroed. WhenkeepJournalisfalse,Openfrees the unsaved header and active region pages so subsequent unjournaled writes cannot leave a stale importable journal.nilpointer (fs.journal.Load()), and regular-file allocation/truncation/release paths track whether any regular file holdsMemoryFileoffset 0 (fs.pageZeroOwner, guardingCompareAndSwapininode.decRefbehind a pointer load) soPrepareJournalcan relocate page 0 when activating journaling on an already-populatedtmpfs.Interface
--journaling-rootfs-upper=onfor the root container, or (with--journaling-rootfs-upper-annotations=on)dev.gvisor.journal.rootfs.upper: "true"per container (.<container-name>in multi-container pods). Requires a file-backed rootfs overlay such as--overlay2=root:self(the default) or--overlay2=root:dir=<dir>. Withroot:self, the combined journal+filestore lives at<rootfs>/.gvisor.filestore.<sandbox-id>, hidden from the container by an upper-layer whiteout without modifying/timestamps, locked with an exclusiveflock, and preserved byContainer.Destroyso external tooling can extract or re-import it.--journaling-rootfs-upper-import=<path-or-/proc/self/fd/N>or (with--journaling-rootfs-upper-annotations=on)dev.gvisor.journal.rootfs.upper.import[.<name>](procfs/devfdpaths are accepted via the CLI flag only). Works independently of runtime journaling:root:self,runschardlinks the imported file to<rootfs>/.gvisor.filestore.<new-sandbox-id>(falling back to the imported FD directly across mounts) and continues journaling in place.tmpfsreplays and adopts the imported filestore in place, clears the journal header/region, and runs unjournaled.--journaling-rootfs-upper-image-idand (with--journaling-rootfs-upper-annotations=on)dev.gvisor.journal.rootfs.upper.image-id[.<name>]optionally record the lower image identity on creation and verify it on import when non-empty; when omitted on import (the default), image ID verification is skipped.restore,--fs-restore-image-path, ordev.gvisor.tar.rootfs.upperhides any self-backed filestore before tasks start, runsPrepareJournal(relocating any regular-file page at offset 0 and writingincompleteBit) followed byActivateJournalonce population completes, and waits for pending activation before reporting a clean0container exit.--journaling-rootfs-upper-importis refused alongsiderestore, filesystem restore, or rootfs upper tar.g3doc/user_guide/checkpoint_restore.mdcompares checkpoint/restore, filesystem snapshots, rootfs tar snapshots, and the journaling rootfs upper.Benchmarks
Interleaved
n=16before vs. after on unjournaledtmpfs(//pkg/sentry/fsimpl/tmpfs:tmpfs_testand//pkg/sentry/fsimpl/tmpfs:benchmark_test), showing no statistically significant change when journaling is off:Per-operation journaling overhead (
BenchmarkJournalCreateWriteUnlink,n=16,journaled=falsevs.journaled=trueforOpenAt(O_CREAT)+ 4 KiBPWrite+Close+UnlinkAt, appending 7 CRC32C-checked records to theMAP_SHAREDactive region):Enabling journaling adds ~2.33µs across the full create + 4 KiB write + unlink cycle (~330ns per appended metadata record).
Testing
//pkg/sentry/pgalloc:pgalloc_test(AdoptExisting, hole-punching, unsaved exclusions acrossSaveTo/LoadFrom)//pkg/sentry/fsimpl/tmpfs/journal:journal_test(round-trip,keepJournal=falseheader/region clearing, torn tail recovery, compaction, region relocation,FilestoreEndshrinking, untrusted input validation)//pkg/sentry/fsimpl/tmpfs:tmpfs_test(crash/rebuild model comparison, unjournaled import, concurrent compaction, page-0 relocation onPrepareJournal+ActivateJournal)//runsc/config:config_test,//runsc/specutils:specutils_test,//runsc/boot:boot_test,//runsc/container:container_test(TestJournalingRootfsUpper*:SIGKILL& clean exit persistence,/proc/self/fd/Nimport, unjournaled import, optional image ID verification,--journaling-rootfs-upper-annotationsgating,flockcontention,FilestoreEndshrink verification, bidirectional checkpoint/fs-checkpoint/tar interop, fast-exit activation synchronization, activation fault injection, multi-container pods, overlay validation)_overlay_journal,_overlay_journal_save, and_overlay_journal_save_resumesyscall test variants