with it on, with every acknowledged file intact either way.
Candidate patch 3, NOT promoted (refs/cand/m-reloc/{mn,618}/topic,
-89ce38550c4e / b73973cf54bb): "btrfs: relocation: flush fully before
+9971f3238ceb / 19e3ca085180; zb64 49c28497f96e / 829ecda8abee on the
+lanes 2550544f9c6e / 7626a4a10198): "btrfs: relocation: flush fully before
failing a merge reservation". merge_reloc_root() refills relocation's
block reserve before each merge step with BTRFS_RESERVE_FLUSH_LIMIT (no
delayed-ref run, commit, delalloc flush or global-reserve steal), and a
relocation aborted with "merge_reloc_roots:2053 errno=-28" while the global
reserve was full. The patch refills with BTRFS_RESERVE_FLUSH_EVICT. To
verify: at the fill edge, merges whose refill must wait are served by
-flushing instead of aborting. Runs on dhive; evidence in
+flushing instead of aborting.
+
+Why FLUSH_EVICT (2026-10-22; the full analysis is in the commit message,
+which replaced the 10-21 message; the code is unchanged apart from its
+comment). 44d354abf33e changed this refill from FLUSH_ALL to FLUSH_LIMIT
+only so that a fatal signal cannot interrupt the merge (FLUSH_ALL waits
+killably, and -EINTR here forces read-only); no deadlock was given. No
+existing mode is "delayed refs + commit, no delalloc, no steal,
+non-killable": FLUSH_LIMIT has no delayed refs, FLUSH_ALL(_STEAL) waits
+killably, and FLUSH_EVICT is the only non-killable mode with delayed refs.
+It runs its states in order and stops at the first that serves the ticket.
+In the runs below, all 6 merge tickets were served by delayed items or
+delayed refs (5 needed FLUSH_DELAYED_REFS(_NR)); none reached delalloc,
+the commit or the global-reserve steal. Deadlock check: at the refill the
+merging task holds no transaction handle, no tree lock and not
+reloc_mutex. It does hold cleaner_mutex, reclaim_bgs_lock, the exclusive
+operation and sb_start_write, none of which writeback, ordered completion
+or commit takes. The same task already commits in this context
+(prepare_to_merge(), after the merge), already waits on FLUSH_ALL's
+delalloc+commit flushing (prepare_to_merge()), and already runs FLUSH_EVICT
+from delayed iputs in btrfs_end_transaction_throttle(). That throttle call
+itself committed from this loop until 302167c50b32 (2019); it no longer
+does. FLUSH_ALL was not run: it brings back the
+-EINTR that 44d354abf33e removed, and it would flush the same states. Runs on dhive; evidence in
`raid56-wh-harness/forensics/m-reloc-20261021/`.
Kernel under test for the "Current" column: misc-next zb64 568c45b64012
| test | verifies | patch(es) | duration | last result | date | kernel | harness | evidence |
|---|---|---|---|---|---|---|---|---|
-| `reloc-merge-enospc-test.sh` (RM_MODE compact, relocate, balance; three arms in parallel) | a relocation at the fill edge does not abort the filesystem in merge_reloc_roots | 3 (candidate) | up to 3.5 h per arm (KASAN, loaded rig) | Lane (misc-next zb64 9c343098c7ea, dhive #1, and #5): FAIL as expected, `merge_reloc_roots:2053 errno=-28` + forced readonly in 3 of 3 reclaim arms (#5 compact +88 min; lane relocate +63 min, compact +128 min); the failing FLUSH_LIMIT tickets found metadata free 0-16 KiB with the global reserve full. Candidate 98b80bb2004f (#2) and candidate + the reclaim backoff (#3): no merge failed in 6 arms; 5 merge refills were served only by FLUSH_DELAYED_REFS(_NR), which FLUSH_LIMIT does not run. relocate arm PASS on both, balance arm PASS on #3. compact arm FAIL on both, on a different abort: ENOSPC in a commit's delayed refs right after a relocation's merge frees a burst of tree blocks (no merge ticket in the #3 arm, so not this patch; see Not covered). balance arm on #2: an unexplained -EIO abort (update_ref_for_cow; no merge ticket there). | 2026-10-21/22 | lane #1, #5; candidate #2; #3 = candidate + refs/cand/reclaimbackoff | 83e731a..ea3371c | forensics/m-reloc-20261021/ |
+| `reloc-merge-enospc-test.sh` (RM_MODE compact, relocate, balance; three arms in parallel) | a relocation at the fill edge does not abort the filesystem in merge_reloc_roots | 3 (candidate) | up to 3.5 h per arm (KASAN, loaded rig) | Lane (misc-next zb64 9c343098c7ea, dhive #1, and #5): FAIL as expected, `merge_reloc_roots:2053 errno=-28` + forced readonly in 3 of 3 reclaim arms (#5 compact +88 min; lane relocate +63 min, compact +128 min); the failing FLUSH_LIMIT tickets found metadata free 0-16 KiB with the global reserve full. Candidate 98b80bb2004f (#2; the current zb64 49c28497f96e differs only in the code comment and the lane's resize-missing ioctl.c change) and candidate + the reclaim backoff (#3): no merge failed in 6 arms; 5 merge refills were served only by FLUSH_DELAYED_REFS(_NR), which FLUSH_LIMIT does not run. relocate arm PASS on both, balance arm PASS on #3. compact arm FAIL on both, on a different abort: ENOSPC in a commit's delayed refs right after a relocation's merge frees a burst of tree blocks (no merge ticket in the #3 arm, so not this patch; see Not covered). balance arm on #2: an unexplained -EIO abort (update_ref_for_cow; no merge ticket there). | 2026-10-21/22 | lane #1, #5; candidate #2; #3 = candidate + refs/cand/reclaimbackoff | 83e731a..ea3371c | forensics/m-reloc-20261021/ |
| `reclaim-errno-test.sh` | a failed background reclaim logs its errno | 1 | 30 s | PASS: "error relocating chunk 298844160: -5", allocation/data/reclaim_errors 0 -> 1, no WARN. Negative control on the series' base kernel (0c48d26d46bd, ehive #2, 2026-10-19): FAIL, "error relocating chunk 298844160" without the code | 2026-10-18 | misc-next #5 | b4ecda8 | ehive /root/tst-new/new5.log; forensics/t-ehive-topics-20261018/ehive/legacy-prepare-base-kernel.log |
**reloc-merge-enospc-test.sh.** The octopus P1 pass up to T5 on its own
## Not covered / open
-- Candidate patch 3 fixes the merge abort only. A second abort at the same
- fill edge remains: right after a relocation's merge, the subtree swap and
- reloc tree drop free a burst of tree blocks (85 MiB pinned in 10 s on a
- 256 MiB metadata space), the global reserve drains, and the commit's
- delayed refs fail with ENOSPC in __btrfs_free_extent. It is generic
- relocation code; the reclaim backoff candidate does not stop it (its
- 8 MiB metadata room check passed). It needs a reclaim-side headroom
- check sized to the relocation; not attempted here.
+- OPEN TASK (abort 2, to be assigned; not fixed): the commit after a
+ relocation at the fill edge aborts with ENOSPC in the delayed refs.
+ Candidate patch 3 fixes only the merge abort; this one remains. Seen
+ twice, both on the reloc-merge-enospc-test compact arm (6 x 3 GiB raid5
+ data, raid1 metadata in a 256 MiB metadata space, 6 MiB unallocated):
+ - combo-compact (candidate + reclaim backoff, `7.3.0-rc7+ #3`), at
+ +2 h 55 min. The reclaim worker had been relocating data group
+ 25699418112 for 280 s. Its merge (prepare_to_merge: nodes_relocated
+ 0, 224 KiB reserve) finished at 10701.03 s with no merge ticket. Over
+ the next 10 s the metadata space_info went from used 195 MiB, pinned
+ 1 MiB, may_use 47 MiB, global reserve 30.6/30.6 MiB to used 158 MiB,
+ pinned 86 MiB, may_use 7 MiB, global reserve 3.5/30.6 MiB. Then
+ btrfs_async_reclaim_data_space -> COMMIT_TRANS -> run_delayed_refs ->
+ __btrfs_free_extent -> lookup_extent_backref -> btrfs_cow_block ->
+ btrfs_use_block_rsv = -28: `__btrfs_free_extent:3438 errno=-28`,
+ "failed to run delayed ref for logical 29342982144 num_bytes 45056
+ type 184 (SHARED_DATA_REF) action 2". The backoff's 8 MiB (512-node)
+ metadata room check had passed with about 9 MiB free when the
+ relocation started.
+ - cand-compact (candidate alone, `#2`), at +169 min:
+ `WARNING: extent-tree.c:3185 at __btrfs_free_extent`. The path was
+ async metadata reclaim -> COMMIT_TRANS -> run_delayed_refs ->
+ __btrfs_free_extent -> btrfs_del_csums -> btrfs_cow_block ->
+ btrfs_use_block_rsv = -28, then "Transaction 14761 aborted
+ (-ENOSPC)". The global reserve was full (31227904) 10 s before. For
+ the previous minute the reclaim worker had failed relocations with a
+ clean -28 from prepare_to_merge() about once a second (683 failed
+ 16 KiB reservations in 115 s). Each failed attempt's unwind freed what
+ it had relocated, and those csum deletions ran in this commit.
+ - Shape: btrfs_use_block_rsv() fails only after the delayed-refs
+ reserve, a NO_FLUSH reservation, the global reserve and
+ FLUSH_EMERGENCY have all failed. So the frees that relocation queues
+ (the subtree swap, the reloc tree drop, or a failed attempt's unwind)
+ reach the commit with too little reserved behind them, and the global
+ reserve covers the difference until it runs out. The size of that
+ cost scales with the tree blocks that reference the group, not with a
+ constant. Not yet checked, and part of the task: where those delayed
+ refs are reserved (or not), and whether a headroom check before
+ relocation, or reserving the drop's cost, stops it.
+ - The lane never got this far, because its merges aborted first. It is
+ generic relocation code: no stripe compaction (whole-group
+ relocation) and no merge ticket in the combo arm. Evidence:
+ `raid56-wh-harness/forensics/m-reloc-20261021/` (combo-compact,
+ cand-compact; README, "Candidate + reclaim backoff").
- The -EIO abort in the candidate's user-balance arm was seen once and not
explained (no transid or csum error before it).
- The merge refill is also used by mount-time relocation recovery; that