Skip to content

sdk/rust: Fix stale base inodes after remount in overlayfs#318

Merged
penberg merged 1 commit intotursodatabase:mainfrom
broady:fix/overlayfs-stale-base-inodes-remount
Feb 13, 2026
Merged

sdk/rust: Fix stale base inodes after remount in overlayfs#318
penberg merged 1 commit intotursodatabase:mainfrom
broady:fix/overlayfs-stale-base-inodes-remount

Conversation

@broady
Copy link
Contributor

@broady broady commented Feb 9, 2026

After remount, origin mappings (fs_origin table) recreate overlay inodes
tagged Layer::Base with stale underlying_ino values from the previous
HostFS session. The new HostFS has a fresh inode cache, so any
operation using the stale inode (lookup, readdir, unlink, etc.) fails
with NotFound.

Fix by not creating a new Base-tagged overlay inode when the origin
mapping's base_ino has no live entry in the reverse_map. This only
happens after remount (the reverse_map is empty); within a session
promote_to_delta already keeps it correct. Falling back to the Delta
overlay inode is safe because all downstream code already walks base
from root when the parent is tagged Delta.

Add 4 tests covering base file lookup, whiteout creation, delta entry
cleanup, and link copy-up across remount boundaries.

@broady broady force-pushed the fix/overlayfs-stale-base-inodes-remount branch 2 times, most recently from d5187c6 to 72a3568 Compare February 9, 2026 08:51
After remount, origin mappings (fs_origin table) recreate overlay inodes
tagged Layer::Base with stale underlying_ino values from the previous
HostFS session.  The new HostFS has a fresh inode cache, so any
operation using the stale inode (lookup, readdir, unlink, etc.) fails
with NotFound.

Fix by not creating a new Base-tagged overlay inode when the origin
mapping's base_ino has no live entry in the reverse_map.  This only
happens after remount (the reverse_map is empty); within a session
promote_to_delta already keeps it correct.  Falling back to the Delta
overlay inode is safe because all downstream code already walks base
from root when the parent is tagged Delta.

Add 4 tests covering base file lookup, whiteout creation, delta entry
cleanup, and link copy-up across remount boundaries.
@broady broady force-pushed the fix/overlayfs-stale-base-inodes-remount branch from 72a3568 to 0ac1e28 Compare February 9, 2026 23:51
@penberg
Copy link
Collaborator

penberg commented Feb 13, 2026

Thanks @broady!

@penberg penberg merged commit a1edea6 into tursodatabase:main Feb 13, 2026
34 checks passed
@broady broady deleted the fix/overlayfs-stale-base-inodes-remount branch February 13, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants