Skip to content

Fix symlink storage and add directory reparenting - #12

Open
flowerishere wants to merge 4 commits into
arihant2math:mainfrom
flowerishere:main
Open

flowerishere wants to merge 4 commits into
arihant2math:mainfrom
flowerishere:main

Conversation

@flowerishere

Copy link
Copy Markdown

This is a follow-up to MOSS #322 (https://github.com/hexagonal-sun/moss-kernel/pull/322). That PR needed a couple of workarounds for symlinks and moving directories, so I’m bringing the relevant fixes into ext4plus.

For symlinks, the main fix is to stop treating inline target bytes as block pointers on the last unlink. This also fixes the 60-byte boundary: targets up to 59 bytes stay inline, while longer targets use a data block.

The other part adds Dir::reparent(old_parent, new_parent). It updates the existing .. entry and its checksum without rebuilding the directory or its htree index. Moving the directory entries, updating parent link counts, and preventing cycles are still the caller’s responsibility.

I also added checks around symlink creation and some error handling for failed writes, along with regression tests. Both commits passed all eight feature combinations, and the modified test images passed e2fsck.

Use inode block accounting to distinguish fast symlinks from block-backed
targets and skip block-map traversal when freeing inline targets. Store
60-byte targets in a data block and reject empty or oversized targets
before allocating an inode.

Validate the parent and check for existing names before creation. Reclaim
unpublished inodes on initialization or target-write failures, while
retaining entries already published when directory insertion reports an
I/O error.

Add ext2/ext4 boundary, hard-link, invalid-request, and injected-write
failure coverage. Validate all eight std/sync/multi-threaded feature
combinations with filesystem checks enabled.
Expose Dir::reparent(old_parent, new_parent) as a raw directory rename
building block. Validate the dot records, htree layout, and destination
inode before changing only the .. inode number and first-block checksum.
Leave namespace moves, cycle prevention, and parent link counts to callers.

Reject corrupt htree counts before checksum slicing and attempt to restore
the original disk block when the update reports a write failure.

Cover linear directories, htree roots at two depths, invalid layouts and
requests, no-op calls, and errors before or after partial/full writes.
Copilot AI balanced review requested due to automatic review settings October 14, 2026 08:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Replace the let-chain in block allocation with Rust 1.86-compatible code,
limit the transaction test helper to std-enabled tests, and address the
stable and beta Clippy diagnostics without disabling warnings.

Stop the feature script on its first failure. Check the library across all
feature combinations and check the async-only xtask separately instead of
building it against the synchronous library API. Remove references to an
undefined workflow matrix.

Update rustls, rustls-webpki, Tokio, and webpki-roots to resolve dependency
advisories. Align xtask with the existing SHA-2 0.11 dependency to remove
duplicate crypto crates, adapt the hashing helpers, and verify the output
against known SHA-256 vectors.
Always generate and upload the coverage report as a workflow artifact.
Keep Codecov uploads for pull requests, which support tokenless uploads,
and for pushes when CODECOV_TOKEN is configured. Preserve fail_ci_if_error
for those uploads so a missing fork secret does not fail an otherwise
successful push CI run.
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