meta: reap detached trees that contain immutable files - #7407
Open
solracsf wants to merge 1 commit into
Open
Conversation
Clone copies the source node wholesale, flags included, so cloning a tree with a chattr +i file produces immutable copies. When a clone is interrupted the top directory stays detached, and its cleanup goes through emptyDir -> BatchUnlink/Rmdir, which refuse entries carrying FlagImmutable or FlagAppend (uid 0 does not bypass that). CleanupDetachedNodesBefore then failed on the tree on every gc --delete, logging an error each run while the tree kept its slice references alive, so those blocks could never be reclaimed. Mark the context used to remove a detached tree and let the flag checks in doBatchUnlink and doRmdir stand down for it, in all three engines. A detached tree is unreachable and this cleanup is its only way out. Removal of reachable files is untouched: the marker is set only by doCleanupDetachedNode. Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
solracsf
force-pushed
the
fix/detached-tree-immutable
branch
from
August 17, 2026 12:02
60f5d46 to
86f46e0
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7407 +/- ##
===========================================
+ Coverage 34.47% 45.03% +10.56%
===========================================
Files 140 177 +37
Lines 48322 58723 +10401
===========================================
+ Hits 16658 26448 +9790
+ Misses 29984 29212 -772
- Partials 1680 3063 +1383 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Clone copies the source node wholesale, flags included, so cloning a tree with a
chattr +ifile produces immutable copies. When a clone is interrupted the top directory stays detached, and its cleanup goes throughemptyDir -> BatchUnlink/Rmdir, which refuse entries carryingFlagImmutableorFlagAppend(uid 0 does not bypass that).CleanupDetachedNodesBeforethen failed on the tree on everygc --delete, logging an error each run while the tree kept its slice references alive, so those blocks could never be reclaimed.Mark the context used to remove a detached tree and let the flag checks in
doBatchUnlinkanddoRmdirstand down for it, in all three engines. A detached tree is unreachable and this cleanup is its only way out.Removal of reachable files is untouched: the marker is set only by
doCleanupDetachedNode.