Repository navigation
Conversation
|
Reviewed against current master and Linux 6.6.139, including an independent subagent review. Skipping this PR because the original premise no longer matches the mmap path.
The proposed fallback selects Please retain the fixed backing-file lifetime design. Any remaining panic on current master needs a reproducer tracing where a VMA bypasses that binding. No changes have been pushed and this PR has not been merged. |
|
Agreed, closing. Verified on current master ( |
OverlayFS has no page cache of its own: file data lives in the upper/lower backing inode, so a mapping bound to the overlay inode cannot be faulted. The trait default map_pages() panics, which takes down the whole kernel; in syscall context the panic is swallowed by catch_unwind and surfaces as "disk I/O error: operation not supported", and in user-fault context it parks the machine. mmap_effective_file() already returns the backing file, which is what keeps VMAs off the overlay inode in the normal case (matching ovl_mmap()'s vma_set_file()). Two gaps remain: 1. The overlay file may have lost its private data when a shared mapping outlives the descriptor (EBADF). Fall back to opening the current real inode with the original access flags and hand *that* file to the VMA, so the binding is still a real file. The real inode is resolved once, at mapping creation, so a later copy-up cannot move an existing mapping to another inode. 2. If a mapping still reaches OverlayFS::map_pages, report SIGBUS with one diagnostic instead of panicking the kernel. This keeps the fixed backing-file lifetime design: no per-fault backing lookup, no page mapping from the overlay inode, and no change to the page-cache or fault-around paths. Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
e1d6bd6 to
1ad2ac7
Compare
|
Reworked per the review; please take another look (force-pushed, The previous patch tried to serve faults from the overlay inode and is gone. The new patch keeps the fixed backing-file lifetime design and only closes the two gaps around it:
No page mapping from the overlay inode, no changes to fault-around or page_mkwrite, and the normal path is unchanged. Status of the reproducer you asked for: on current master ( |
|
Behaviour check for the reworked patch (
So keeping the VMA on a real backing file is sufficient in practice; the page-mapping approach from the first revision is gone. |
…y#2568 v2, DragonOS-Community#2569 findings) Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
Problem
OverlayFSnever implementedFileSystem::map_pages, so the default implementation panicked:(
do_page_fault → handle_mm_fault → do_fault → OverlayFS::map_pages);catch_unwindand surfaced asdisk I/O error: operation not supported(sqlite:SQLITE_IOERR_WRITE,sysErrno=95).Both sqlite's WAL
-shmmapping and JVM/kafka startup (whichmmapfiles from thecontainer overlay) hit this path.
Root cause
OverlayFS keeps no page cache of its own:
OvlInode::page_cache()isNone, and filedata pages belong to the upper/lower backing inode.
mmap_effective_file()normallyrebinds the VMA to the backing file, but a shared mapping can still stay bound to the
overlay file (e.g. when the descriptor was closed and
private_databecameUnused,while POSIX keeps the mapping valid).
Changes
mm/fault.rsfilemap_map_pagesinto a cache-owner parametrised helper; addfilemap_map_pages_for_inodeoverlayfs/fs.rsmap_pages: peelMountFSInodeprojections to theOvlInode, resolve the current real data inode, map its pages; unresolvable inodes return SIGBUS with a diagnostic instead of panickingvfs/mount/mod.rsVfsDentry::inode()accessor used by that peelVerification
make kernelpasses;cargo +nightly-2026-02-24 fmt --all -- --checkclean.both WAL and DELETE modes, kafka/msg-etl start successfully, no
map_pagespanic.