Repository navigation
fix(libcontainer): preserve sync and dirsync on fd-based mounts - #3838
Open
dongxuelian2 wants to merge 1 commit into
Open
dongxuelian2 wants to merge 1 commit into
dongxuelian2 wants to merge 1 commit into
Conversation
Signed-off-by: dongxuelian2 <2984896280@qq.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix preserves existing mount semantics and fallback behavior, with appropriate regression coverage and no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes #3818 by preserving sync and dirsync on non-bind mounts created through the file-descriptor-based mount path.
Changes:
- Forwards enabled superblock flags through
fsconfigbefore filesystem creation. - Preserves parsed
asyncordering and existing legacy fallback behavior. - Adds parser, syscall-flow, fallback, and opt-in privileged kernel regression tests.
| File | Description |
|---|---|
crates/libcontainer/src/rootfs/utils.rs |
Adds tests for parsing sync flags and option ordering. |
crates/libcontainer/src/rootfs/mount.rs |
Applies superblock flags through fsconfig and adds regression coverage. |
Review effort: Balanced
This branch has not been deployed
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.
Description
Non-bind mounts created through
fsopen/fsconfigsilently losesyncanddirsync. The OCI option parser already recordsMS_SYNCHRONOUSandMS_DIRSYNC, but the fd-based mount path only forwards filesystem data tofsconfig; neither flag can be applied bymount_setattr.Pass the enabled flags as
FSCONFIG_SET_FLAGoptions before creating the filesystem. This uses the existing parsed flags, soasyncstill clearssyncin option order. The existing legacy fallback continues to receive the original mount flags and propagate mount errors.Type of Change
Testing
Automated validation on Ubuntu 24.04, x86_64, Linux
6.17.0-1022-azure:syncfsconfig call, and passes with the fix.cargo +nightly fmt --all -- --check: passed.cargo +1.96.0 clippy -p libcontainer --all-targets --all-features --locked -- -D warnings: passed with the repository's pinned toolchain.cargo +1.96.0 clippy --workspace --all-targets --all-features --locked -- -D warnings: passed.cargo +stable test --workspace --all-features --locked --no-fail-fast -- --test-threads=1: 570 passed, 1 ignored (the privileged test described above), using the documented serial setting and a fresh devpts instance in a private mount namespace.git diff --check: passed.The original parallel workspace test command timed out in
process::fork::test::test_container_err_fork. A serial run on the runner's original PTY setup failed two TTY tests; the same two failures were reproduced on unmodified upstream. The complete serial suite passed after creating a devpts instance withptmxmode=0666inside a private mount namespace. No tests were skipped or assertions relaxed to obtain that result.Current stable 1.99.1 workspace clippy still reports two
manual_filtererrors in unchangedsyscall/linux.rsat lines 722 and 730. The pinned 1.96.0 check passes. No lint suppression or unrelated source changes were added.Mount and OCI validation logs, passing full workspace tests and upstream PTY comparison, workspace clippy results.
The tmpfs checks establish flag retention, not disk durability or performance. Other kernels, filesystems and architectures were not exercised.
Related Issues
Fixes #3818
Additional Context
AI assistance was used for investigation, implementation, regression tests, validation, and drafting this description. The reported checks were executed through automated tools; no human review is claimed. The contribution is one commit signed off using the author's existing Git identity. Validation-only workflow and fixture files are kept on a separate fork branch and are excluded from this PR.