System chunks are not covered: balance -m relocates them too, and a
full filesystem can still fail there.
+[Candidate patch 3, not yet in this series (refs/cand/m-reloc):
+"btrfs: relocation: flush fully before failing a merge reservation".
+merge_reloc_root() refills relocation's block reserve with
+BTRFS_RESERVE_FLUSH_LIMIT, so at the fill edge a merge step can fail
+with ENOSPC, which forces the filesystem read-only, while delayed refs,
+a commit or the global reserve could have served it. The patch uses
+BTRFS_RESERVE_FLUSH_EVICT. If promoted, this letter needs a paragraph
+on it and the subject becomes 0/3. It does not cover the other abort
+found at the same edge (a commit's delayed refs after a relocation frees
+a burst of tree blocks); see TESTING.md.]
+
Zygo Blaxell (2):
btrfs: print the error when reclaim fails to relocate a block group
btrfs: hold block groups free for relocation
-dusage/-musage must fail with ENOSPC with the reserve off and complete
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
+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
+failure there forces the filesystem read-only. At the fill edge a reclaim
+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
+`raid56-wh-harness/forensics/m-reloc-20261021/`.
+
Kernel under test for the "Current" column: misc-next zb64 568c45b64012
(uname 7.3.0-rc7+ #5, KASAN + lockdep) unless a row says otherwise. That
kernel is the 17-topic integration, so it also carries the octopus-only
| 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/ |
| `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
+images: 6 x 3 GiB behind dm-linear, raid5 data / raid1 metadata,
+stripe_alloc, nodiscard, 4000 oracle files, the last member reloaded to the
+dm error target, scrub, balance -d, then fsstress -p 8 for 3.5 h. It fails
+on any abort of this filesystem or a kernel-wide KASAN/BUG/WARN/lockdep/hung
+task line, and passes only if the filesystem reached the edge (unallocated
+< 512 MiB) and relocations ran there. fprobe events with BTF arguments
+trace each refill of relocation's reserve inside a merge with the metadata
+space_info and the global reserve, plus tickets and flush states, so a run
+shows whether a merge refill needed flushing and which state served it.
+Limits: the abort needs a merge whose refill cannot be met at once; it came
+1-2 h into the lane arms and not at all in some arms, so a PASS with no
+merge ticket says nothing about the patch; the stripe_alloc raid5 fill is
+the trigger, the failing code is generic.
+
**reclaim-errno-test.sh.** Single 12G device, data single: a keep file
and a filler in one data group; 64K of the keep file is overwritten on the
device behind the filesystem, the filler is deleted (the group drops below
## 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.
+- 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
+ path was not exercised.
+
- `RR_STRIPE_ALLOC=1` (the octopus-only integration with stripe-alloc) was
not rerun this round; its last result (bhive #25, 2026-10-15: resync
exercised, the known reserve-on stripe_meta metadata grind ran to the