Skip to content

fix(fs): preserve recursive delete child whiteouts#2056

Merged
chaliy merged 2 commits into
mainfrom
fix/pr-2047-fs-delete-whiteouts
Jun 12, 2026
Merged

fix(fs): preserve recursive delete child whiteouts#2056
chaliy merged 2 commits into
mainfrom
fix/pr-2047-fs-delete-whiteouts

Conversation

@chaliy

@chaliy chaliy commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Closes #2047

rm -rf on a directory was dropping whiteout entries for files deleted in child directories, causing them to reappear on VFS layer merge. Child whiteouts are now preserved during recursive deletion.


Generated by Claude Code

Copilot AI review requested due to automatic review settings June 12, 2026 10:01
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 12, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit f70db5b Commit Preview URL

Branch Preview URL
Jun 12 2026, 10:11 AM

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.

Pull request overview

This PR fixes OverlayFs recursive deletion semantics so that rm -rf <dir> preserves deletion intent for lower-layer children even if the parent directory is later recreated in the upper layer, preventing lower children from reappearing during overlay merges (and addressing the quota/threat-model scenario in #2047).

Changes:

  • Materialize per-child whiteouts during recursive lower-directory deletion (hide_lower_children_recursive) and ensure recursive delete enumerates lower children even when an upper directory exists.
  • Adjust remove() logic so recursive directory deletes still traverse/deduct lower children, while avoiding double-deduction when an upper override already hides the lower entry.
  • Add regression test ensuring rm -r /dir; mkdir /dir does not re-expose lower children.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/bashkit/src/fs/overlay.rs Outdated
Comment thread crates/bashkit/src/fs/overlay.rs Outdated
Symlink and Fifo lower-layer entries were not getting per-child whiteouts
during recursive delete (hide_lower_children_recursive) and were not being
deducted from lower_hidden in remove(), allowing them to reappear and
causing inaccurate usage accounting after parent directory recreation.
@chaliy chaliy merged commit f4875b4 into main Jun 12, 2026
35 checks passed
@chaliy chaliy deleted the fix/pr-2047-fs-delete-whiteouts branch June 12, 2026 10:20
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