]> git.hungrycats.org Git - linux/commitdiff
read-repair-fixes 0/4, raid56-fixes 0/12: leave raid56 as upstream after an abort
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 23 Oct 2026 01:42:01 +0000 (21:42 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 23 Oct 2026 01:42:01 +0000 (21:42 -0400)
Zygo: the "no writes after abort" rule is less strict than assumed and
is under revision upstream, so raid56 keeps upstream behavior.  The
parity-scrub check (read-repair-fixes 5) and the RMW write-back check
(raid56-fixes 12) are dropped from both lanes; the covers, README and
TESTING.md follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B6wxsJn1aY7PwnhgXdz6Ec

24 files changed:
README.md
fixups/post-merge.patch
topics/raid56-fixes/0000-cover-letter.patch
topics/raid56-fixes/0001-btrfs-log-a-message-when-dropping-an-extent-due-to-I.patch
topics/raid56-fixes/0002-btrfs-raid56-fix-use-after-free-of-rbio-in-bio-end_i.patch
topics/raid56-fixes/0003-btrfs-propagate-a-split-bio-s-error-when-the-failing.patch
topics/raid56-fixes/0004-btrfs-raid56-drop-cached-rbios-when-their-stripes-ex.patch
topics/raid56-fixes/0005-btrfs-raid56-verify-reconstructed-tree-blocks.patch
topics/raid56-fixes/0006-btrfs-raid56-keep-a-reference-on-a-stolen-cached-rbi.patch
topics/raid56-fixes/0007-btrfs-raid56-do-not-unhash-a-cached-rbio-that-has-rb.patch
topics/raid56-fixes/0008-btrfs-raid56-do-not-let-a-failed-write-leave-its-pag.patch
topics/raid56-fixes/0009-btrfs-raid56-rebuild-from-Q-when-a-sector-rebuilt-fr.patch
topics/raid56-fixes/0010-btrfs-raid56-count-I-O-errors-in-the-device-stats.patch
topics/raid56-fixes/0011-btrfs-raid56-write-back-the-sectors-a-sub-stripe-wri.patch
topics/raid56-fixes/0012-DO-NOT-UPSTREAM-btrfs-raid56-debug-knob-for-the-rbio.patch [new file with mode: 0644]
topics/raid56-fixes/0012-btrfs-raid56-no-RMW-write-back-of-repaired-sectors-a.patch [deleted file]
topics/raid56-fixes/0013-DO-NOT-UPSTREAM-btrfs-raid56-debug-knob-for-the-rbio.patch [deleted file]
topics/read-repair-fixes/0000-cover-letter.patch
topics/read-repair-fixes/0001-btrfs-give-the-read-repair-bio-an-end_io-for-submit-.patch
topics/read-repair-fixes/0002-btrfs-look-up-a-repair-read-s-csums-in-the-same-root.patch
topics/read-repair-fixes/0003-btrfs-do-not-write-back-a-read-repair-after-a-transa.patch
topics/read-repair-fixes/0004-btrfs-scrub-do-not-write-back-repairs-after-a-transa.patch
topics/read-repair-fixes/0005-btrfs-raid56-do-not-write-back-parity-scrub-repairs-.patch [deleted file]
topics/read-repair-fixes/TESTING.md

index c126985644892f3f139f583d5da8152172fa23dd..9a4b5116bf06c1eddb704f2ac484025ad94387cb 100644 (file)
--- a/README.md
+++ b/README.md
@@ -8,8 +8,8 @@ upstream at all (see the table).
 | | |
 |---|---|
 | base of every series | `0c48d26d46bd` ("btrfs: stop reading free space inodes from the commit root"), the misc-next lane base (`misc-next/testing^1`) |
-| integration branch | `misc-next/testing` `26986baa3476` (octopus of all 20 topics) |
-| lane head | `zygo-misc-next-zb64` `aee0ffb1fba5`; its own commits on top of `testing` (kernel configs, `covers/`) are not exported |
+| integration branch | `misc-next/testing` `94e2d2a928c6` (octopus of all 20 topics) |
+| lane head | `zygo-misc-next-zb64` `d80f06194759`; its own commits on top of `testing` (kernel configs, `covers/`) are not exported |
 
 The base is not a published commit: the lane rebuilds it from
 btrfs/for-next plus David Sterba's queue.  It lives in the
@@ -67,7 +67,7 @@ the integration recipe below uses.
 | `delalloc-fixes` | 1 | `7c23eb7ad5c9` | Zygo | from misc-next `covers/`, rewritten 2026-10-19 for 0/1 | patch 1 (delalloc leak) dropped 2026-10-19: fixed upstream by 095be159f3eb; 6.18 keeps it |
 | `dev-extent-defrag` | 1 | `40c2fffa8348` | Zygo | new, 0/1 (drafted 2026-10-18) | |
 | `prealloc-size` | 1 | `93d225865ab2` | Zygo | new, 0/1 (drafted 2026-10-18) | |
-| `raid56-fixes` | 13 | `a3629b15df87` | Zygo | new; replaces `covers/raid56-rbio-fixes.txt` (2 of these patches) | **patch 13 is DO-NOT-UPSTREAM** (rbio cache size debug knob); patch 12 (no write-back after abort) to be folded into 11 |
+| `raid56-fixes` | 12 | `f7e693d10be2` | Zygo | new; replaces `covers/raid56-rbio-fixes.txt` (2 of these patches) | **patch 12 is DO-NOT-UPSTREAM** (rbio cache size debug knob) |
 | `raid56-scrub-replace` | 13 | `9970d7e44abf` | Filipe Manana, Zygo | new | patch 1 is Filipe's, already in btrfs/for-next (`ec0795c045c3`) |
 | `stripe-alloc` | 116 | `a23064467620` | Zygo | rewritten 2026-10-22 by subtopic (rebuild planned, REORDER-PLAN.md) | RFC; subtopic 6 (debug) not for merging; stripe_meta may be dropped (STRIPE-META-CLAIMS.md) |
 | `low-space` | 3 | `4f26c7c44896` | Zygo | from misc-next `covers/`, patch 3 paragraph added 2026-10-22 | reserve off by default; patch 3 fixes an upstream relocation abort (FLUSH_LIMIT merge refill) |
@@ -78,7 +78,7 @@ the integration recipe below uses.
 | `replace-fixes` | 7 | `43c8a1e60a5a` | Zygo | new | patch 7 has a btrfs-progs counterpart (`topics/replace-abort-uncorrectable`) |
 | `dev-stats` | 1 | `55ade1cf195c` | Zygo | new, 0/1 (2026-10-21) | behaviour change, offered for rejection; independent of every other series |
 | `resize-missing` | 1 | `8763f9e2126d` | Qu Wenruo, rewritten by Zygo | new, 0/1 (2026-10-21) | Qu's 2019 patch reworked: grow checks now return, absolute sizes checked; Zygo's Signed-off-by to be added before sending |
-| `read-repair-fixes` | 5 | `c2a23411b4c7` | Zygo | new 2026-10-22; rewritten for 0/5 | read repair and scrub after an abort: NULL end_io (v6.3+), same csum root, no repair writes after abort; stable tags on 1-4, none on 5 (raid56) |
+| `read-repair-fixes` | 4 | `9736ec071097` | Zygo | new 2026-10-22; 0/4 | read repair and scrub after an abort: NULL end_io (v6.3+), same csum root, no repair writes after abort; Cc stable on all 4; raid56 left as upstream |
 
 ## Applying one series
 
@@ -205,5 +205,5 @@ The fixup adds 640 lines and removes 16, in 10 files.
 - `balance-resume` patch 3 is offered for rejection, as its cover letter
   says.
 - Re-export with `scripts/export.sh` after any lane change.  The
-  directories reflect the lane at `misc-next/testing` `26986baa3476`.
+  directories reflect the lane at `misc-next/testing` `94e2d2a928c6`.
   Commit the result with the misc-next SHAs that the script prints.
index 2e7f5e2eefb455233adba5a6dbc131541f081808..5cb1a49ade0cd487d68f783f7638782995aeff10 100644 (file)
@@ -175,7 +175,7 @@ index cd3073cc60fe361602e0a154f1e7085dd76a4cc2..cfc0d9a2169a4448eb13ce64128db7ad
        ret = find_free_extent(root, ins, &ffe_ctl);
        if (!ret && !is_data) {
 diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 38b645a1e6131b407a4dd122cb164bd6659a9010..ce47e10d6bc020a5bc7ababadf24ca08b8aa4b15 100644
+index bcf8dbc7fdf8dc3455b08855149f351046850b1c..c10f75587c2310196a13faf797c868d294cc276d 100644
 --- a/fs/btrfs/raid56.c
 +++ b/fs/btrfs/raid56.c
 @@ -991,13 +991,15 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
@@ -476,35 +476,6 @@ index 38b645a1e6131b407a4dd122cb164bd6659a9010..ce47e10d6bc020a5bc7ababadf24ca08
  /*
   * Return true if the rebuild of data sector @sector_nr of @stripe_nr can be
   * trusted enough to write it back.  It can when the sector has a csum: the
-@@ -4731,6 +4975,14 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-       if (rbio->scrub_readonly)
-               goto submit_write;
- 
-+      /*
-+       * No data or parity is repaired after a transaction abort or another
-+       * filesystem error.  A running replace still gets the parity copied
-+       * to its target.
-+       */
-+      if (unlikely(!btrfs_can_submit_repair_write(rbio->bioc->fs_info)))
-+              goto replace;
-+
-       /* Write the data sectors rebuilt from P and Q. */
-       for_each_set_bit(sectornr, &rebuilt, rbio->stripe_nsectors) {
-               const int stripe = rebuilt_stripe[sectornr];
-@@ -4755,13 +5007,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-        * time to start writing.  Make bios for everything from the
-        * higher layers (the bio_list in our rbio) and our p/q.  Ignore
-        * everything else.
--       *
--       * No parity is repaired after a transaction abort or another
--       * filesystem error.  A running replace still gets the parity copied
--       * to its target.
-        */
--      if (unlikely(!btrfs_can_submit_repair_write(rbio->bioc->fs_info)))
--              goto replace;
-       for_each_set_bit(sectornr, &rbio->dbitmap, rbio->stripe_nsectors) {
-               phys_addr_t *paddrs;
- 
 diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
 index d71c5c5f4b2ed8f930cb1c2991f98fbafba35261..cfcd9bce4652f861774763844076ef755cc70475 100644
 --- a/fs/btrfs/raid56.h
index f24283cfedebb663512ed4c80f4c89635cff8bec..73e16305ee1285799c54337bddccc1a7f72b1fd2 100644 (file)
@@ -1,7 +1,7 @@
-From a3629b15df8728a96adce866b6411d73000db1fb Mon Sep 17 00:00:00 2001
+From f7e693d10be20b7f83d5ba52569425bc68c36807 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 22 Oct 2026 18:47:39 -0400
-Subject: [PATCH 00/13] btrfs: raid56: rbio lifetime and cache fixes, error reporting
+Date: Thu, 22 Oct 2026 21:41:29 -0400
+Subject: [PATCH 00/12] btrfs: raid56: rbio lifetime and cache fixes, error reporting
 To: linux-btrfs@vger.kernel.org
 
 Fixes found running raid56 filesystems to ENOSPC under fsstress with a
@@ -92,18 +92,11 @@ a verified csummed sector of the same row are written back; a missing
 device never is, and a failed write-back does not count against the
 write's tolerance.  Fixes: 7a3150723061.
 
-Patch 12 keeps patch 11's write-back from running after a transaction
-abort.  A repair write after an abort is a write the filesystem has
-promised not to make; the same rule now applies to read repair and scrub
-(see the read-repair-fixes series).  It belongs folded into patch 11
-before sending, since patch 11 is not upstream yet.  It has been
-build- and boot-tested only.
-
-Patch 13 is a test fixture and NOT for submission: a CONFIG_BTRFS_DEBUG
+Patch 12 is a test fixture and NOT for submission: a CONFIG_BTRFS_DEBUG
 sysfs knob for the rbio cache size, used by the dm-stripfault tests to
 reach the RMW read path.  Drop it before sending.
 
-Zygo Blaxell (13):
+Zygo Blaxell (12):
   btrfs: log a message when dropping an extent due to IO error
   btrfs: raid56: fix use-after-free of rbio in bio end_io wakeups
   btrfs: propagate a split bio's error when the failing split completes
@@ -120,7 +113,6 @@ Zygo Blaxell (13):
     csum
   btrfs: raid56: count I/O errors in the device stats
   btrfs: raid56: write back the sectors a sub-stripe write repaired
-  btrfs: raid56: no RMW write-back of repaired sectors after an abort
   DO-NOT-UPSTREAM: btrfs: raid56: debug knob for the rbio stripe cache
     size
 
@@ -128,11 +120,11 @@ Zygo Blaxell (13):
  fs/btrfs/bio.h         |   2 +
  fs/btrfs/extent-tree.c |  10 +
  fs/btrfs/fs.h          |   4 +
- fs/btrfs/inode.c       |  16 +
- fs/btrfs/raid56.c      | 642 ++++++++++++++++++++++++++++++++++++++---
+ fs/btrfs/inode.c       |  16 ++
+ fs/btrfs/raid56.c      | 633 ++++++++++++++++++++++++++++++++++++++---
  fs/btrfs/raid56.h      |  14 +-
  fs/btrfs/sysfs.c       |  28 ++
- 8 files changed, 686 insertions(+), 43 deletions(-)
+ 8 files changed, 677 insertions(+), 43 deletions(-)
 
 
 base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
index f25d6246cf7c2d16fe4a68ddb4dbca2fbf075b8d..70ebbcf4aad2fde7e3fc58a64485519d133a4a70 100644 (file)
@@ -1,7 +1,7 @@
 From 06db5c045ee4d05f55678163dc984793966b09af Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 5 Jul 2024 23:08:46 -0400
-Subject: [PATCH 01/13] btrfs: log a message when dropping an extent due to IO
+Subject: [PATCH 01/12] btrfs: log a message when dropping an extent due to IO
  error
 To: linux-btrfs@vger.kernel.org
 
index 3b66e6891896057544fb62bae69fd5b9cda44f1e..f5cbcb9572779aaf54e5d70a92188d9012f6bf1f 100644 (file)
@@ -1,7 +1,7 @@
 From dec088fcc6e6b83401e437af76e1beac9f403bd1 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 25 Jul 2026 16:06:34 -0400
-Subject: [PATCH 02/13] btrfs: raid56: fix use-after-free of rbio in bio end_io
+Subject: [PATCH 02/12] btrfs: raid56: fix use-after-free of rbio in bio end_io
  wakeups
 To: linux-btrfs@vger.kernel.org
 
index ac6a92c941994ba5def68b4930fb2ccb6b22fa47..f21f4de00cd882fdbb44b7817c927662cd3ad4b5 100644 (file)
@@ -1,7 +1,7 @@
 From c4ca7d88372eb775e03b9fb0ae3e080d171256c1 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 1 Aug 2026 01:31:24 -0400
-Subject: [PATCH 03/13] btrfs: propagate a split bio's error when the failing
+Subject: [PATCH 03/12] btrfs: propagate a split bio's error when the failing
  split completes last
 To: linux-btrfs@vger.kernel.org
 
index 1601486e09c0f7a9092f6ddf39b7103b2b7dcd4d..f15d946bd6116e53e4c95c87d243a0b51d64a6fe 100644 (file)
@@ -1,7 +1,7 @@
 From c05f4a996dc3d9f233e27e191e3bc8d1f92492bb Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Mon, 3 Aug 2026 03:24:38 -0400
-Subject: [PATCH 04/13] btrfs: raid56: drop cached rbios when their stripes'
+Subject: [PATCH 04/12] btrfs: raid56: drop cached rbios when their stripes'
  extents are freed
 To: linux-btrfs@vger.kernel.org
 
index e6bb1fa11635701bc448aaf202cced83094fb7fe..49a6166c09e34110de0918a2544d74326ce06180 100644 (file)
@@ -1,7 +1,7 @@
 From 0fe89be282ee3d71b69555adab49dd43729aad45 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Wed, 5 Aug 2026 02:59:50 -0400
-Subject: [PATCH 05/13] btrfs: raid56: verify reconstructed tree blocks
+Subject: [PATCH 05/12] btrfs: raid56: verify reconstructed tree blocks
 To: linux-btrfs@vger.kernel.org
 
 Data sectors recovered from parity are checked against the csum tree
index 66b7e8193472c38a2707560b38dd86f1f066f29d..a09a6be2df94d2f47eda2db1d0934f18cf7d6279 100644 (file)
@@ -1,7 +1,7 @@
 From b2c793a1845e5928abc500c6719aebf14e543c05 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Fri, 4 Sep 2026 22:14:19 -0400
-Subject: [PATCH 06/13] btrfs: raid56: keep a reference on a stolen cached rbio
+Subject: [PATCH 06/12] btrfs: raid56: keep a reference on a stolen cached rbio
  until it is dropped
 To: linux-btrfs@vger.kernel.org
 
index 72527e25f15922bed4b39326367937c804c3ec72..4cdae225aad8a3b8a53729ea41cc423566590d78 100644 (file)
@@ -1,7 +1,7 @@
 From 3a80dae0c04b17fa72ef154d058a763334da4438 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Sat, 12 Sep 2026 07:17:54 -0400
-Subject: [PATCH 07/13] btrfs: raid56: do not unhash a cached rbio that has
+Subject: [PATCH 07/12] btrfs: raid56: do not unhash a cached rbio that has
  rbios plugged on it
 To: linux-btrfs@vger.kernel.org
 
index 9a72c3e2f4cefceb742b11fc2f5e9f6baac5a783..ac61edb88d167375e529868e4a72af2c0f905c78 100644 (file)
@@ -1,7 +1,7 @@
 From 773140d8d8973b91099623dedb025073a34b0974 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 01:19:22 -0400
-Subject: [PATCH 08/13] btrfs: raid56: do not let a failed write leave its
+Subject: [PATCH 08/12] btrfs: raid56: do not let a failed write leave its
  pages for the next write
 To: linux-btrfs@vger.kernel.org
 
index 9c273442d2dfdf688f9ea8e99a435f733ccd94ce..192091f7433f48f4ab93127019bcc7beaad18f14 100644 (file)
@@ -1,7 +1,7 @@
 From d507eefdb5832348bc728b963f3d7c8898ffb0a4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 13:04:12 -0400
-Subject: [PATCH 09/13] btrfs: raid56: rebuild from Q when a sector rebuilt
+Subject: [PATCH 09/12] btrfs: raid56: rebuild from Q when a sector rebuilt
  from P fails its csum
 To: linux-btrfs@vger.kernel.org
 
index 32879db2ee9b8c2b52e7962f20cb630a3aa9158e..8131a08a0f500af955f9a420524d57d956adf1f7 100644 (file)
@@ -1,7 +1,7 @@
 From 6dfdbfdffe7d7f18f1112740a6e3a9baa06dbb93 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 13:43:10 -0400
-Subject: [PATCH 10/13] btrfs: raid56: count I/O errors in the device stats
+Subject: [PATCH 10/12] btrfs: raid56: count I/O errors in the device stats
 To: linux-btrfs@vger.kernel.org
 
 raid56.c submits the reads and writes of a raid56 stripe itself, with its
index 9c1130ef9cb257c0bfc57e016d2f725e0c0e445d..ce8b4997e7e6c80a9f9dc6a9d5c039f656a01e61 100644 (file)
@@ -1,7 +1,7 @@
 From 95d142c556b58d28b69c8c9aa579470eddce6d19 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Tue, 20 Oct 2026 15:52:51 -0400
-Subject: [PATCH 11/13] btrfs: raid56: write back the sectors a sub-stripe
+Subject: [PATCH 11/12] btrfs: raid56: write back the sectors a sub-stripe
  write repaired
 To: linux-btrfs@vger.kernel.org
 
diff --git a/topics/raid56-fixes/0012-DO-NOT-UPSTREAM-btrfs-raid56-debug-knob-for-the-rbio.patch b/topics/raid56-fixes/0012-DO-NOT-UPSTREAM-btrfs-raid56-debug-knob-for-the-rbio.patch
new file mode 100644 (file)
index 0000000..200b232
--- /dev/null
@@ -0,0 +1,194 @@
+From f7e693d10be20b7f83d5ba52569425bc68c36807 Mon Sep 17 00:00:00 2001
+From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
+Date: Thu, 1 Oct 2026 03:54:55 -0400
+Subject: [PATCH 12/12] DO-NOT-UPSTREAM: btrfs: raid56: debug knob for the rbio
+ stripe cache size
+To: linux-btrfs@vger.kernel.org
+
+Test fixture, not for submission.  A read-modify-write whose stripe is
+still in the rbio stripe cache takes the other strips from memory instead
+of reading them, so a test that injects faults into reads (dm-stripfault)
+cannot reach the RMW read path for recently written stripes.
+
+With CONFIG_BTRFS_DEBUG, /sys/fs/btrfs/<uuid>/debug/rbio_cache_size
+replaces the RBIO_CACHE_SIZE limit (default unchanged, 1024); 0 disables
+the cache.  Lowering it empties the cache, and the prune in cache_rbio()
+now loops so a lowered limit holds.
+
+Assisted-by: Claude:claude-opus-5-5
+---
+ fs/btrfs/fs.h     |  4 ++++
+ fs/btrfs/raid56.c | 41 ++++++++++++++++++++++++++++++++++++++---
+ fs/btrfs/raid56.h |  3 +++
+ fs/btrfs/sysfs.c  | 28 ++++++++++++++++++++++++++++
+ 4 files changed, 73 insertions(+), 3 deletions(-)
+
+diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
+index 2dd167c32d612..326a54601289c 100644
+--- a/fs/btrfs/fs.h
++++ b/fs/btrfs/fs.h
+@@ -635,6 +635,10 @@ struct btrfs_fs_info {
+        * trying to mod the same stripe at the same time.
+        */
+       struct btrfs_stripe_hash_table *stripe_hash_table;
++#ifdef CONFIG_BTRFS_DEBUG
++      /* Size limit of the rbio stripe cache (debug/rbio_cache_size). */
++      unsigned int rbio_cache_size;
++#endif
+ 
+       /*
+        * This protects the ordered operations list only while we are
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
+index 5732c2d8ea359..c44e447b7c4a5 100644
+--- a/fs/btrfs/raid56.c
++++ b/fs/btrfs/raid56.c
+@@ -198,6 +198,9 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info)
+       struct btrfs_stripe_hash *h;
+       unsigned int num_entries = 1U << BTRFS_STRIPE_HASH_TABLE_BITS;
+ 
++#ifdef CONFIG_BTRFS_DEBUG
++      WRITE_ONCE(info->rbio_cache_size, RBIO_CACHE_SIZE);
++#endif
+       if (info->stripe_hash_table)
+               return 0;
+ 
+@@ -601,6 +604,23 @@ static void btrfs_clear_rbio_cache(struct btrfs_fs_info *info)
+       spin_unlock(&table->cache_lock);
+ }
+ 
++#ifdef CONFIG_BTRFS_DEBUG
++/*
++ * Test knob (debug/rbio_cache_size): with a small or zero limit, a
++ * read-modify-write cannot take its stripe from the cache and must read it,
++ * which is what a fault-injecting test needs to see.  Lowering it empties the
++ * cache, so the new limit holds from the next rbio on.
++ */
++void btrfs_set_rbio_cache_size(struct btrfs_fs_info *info, unsigned int size)
++{
++      unsigned int old = READ_ONCE(info->rbio_cache_size);
++
++      WRITE_ONCE(info->rbio_cache_size, size);
++      if (size < old && info->stripe_hash_table)
++              btrfs_clear_rbio_cache(info);
++}
++#endif
++
+ /*
+  * remove all cached entries and free the hash table
+  * used by unmount
+@@ -625,12 +645,25 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
+  * If the size of the rbio cache is too big, we
+  * prune an item.
+  */
++/* How many rbios the stripe cache keeps (0: none). */
++static unsigned int rbio_cache_limit(const struct btrfs_fs_info *fs_info)
++{
++#ifdef CONFIG_BTRFS_DEBUG
++      return READ_ONCE(fs_info->rbio_cache_size);
++#else
++      return RBIO_CACHE_SIZE;
++#endif
++}
++
+ static void cache_rbio(struct btrfs_raid_bio *rbio)
+ {
+       struct btrfs_stripe_hash_table *table;
++      const unsigned int limit = rbio_cache_limit(rbio->bioc->fs_info);
+ 
+       if (!test_bit(RBIO_CACHE_READY_BIT, &rbio->flags))
+               return;
++      if (!limit)
++              return;
+ 
+       table = rbio->bioc->fs_info->stripe_hash_table;
+ 
+@@ -650,15 +683,17 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
+ 
+       spin_unlock(&rbio->bio_list_lock);
+ 
+-      if (table->cache_size > RBIO_CACHE_SIZE) {
++      /* A loop, not one eviction: the limit can have been lowered. */
++      while (table->cache_size > limit) {
+               struct btrfs_raid_bio *found;
+ 
+               found = list_last_entry(&table->stripe_cache,
+                                       struct btrfs_raid_bio,
+                                       stripe_cache);
+ 
+-              if (found != rbio)
+-                      __remove_rbio_from_cache(found);
++              if (found == rbio)
++                      break;
++              __remove_rbio_from_cache(found);
+       }
+ 
+       spin_unlock(&table->cache_lock);
+diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
+index c7c4b0db61f4c..8d28e2a77c62b 100644
+--- a/fs/btrfs/raid56.h
++++ b/fs/btrfs/raid56.h
+@@ -295,6 +295,9 @@ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
+ 
+ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
+ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
++#ifdef CONFIG_BTRFS_DEBUG
++void btrfs_set_rbio_cache_size(struct btrfs_fs_info *info, unsigned int size);
++#endif
+ void btrfs_raid56_uncache_range(struct btrfs_fs_info *info, u64 start, u64 len);
+ 
+ #endif
+diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
+index 3ac1fa608d3b5..78688c36f8b02 100644
+--- a/fs/btrfs/sysfs.c
++++ b/fs/btrfs/sysfs.c
+@@ -25,6 +25,7 @@
+ #include "misc.h"
+ #include "fs.h"
+ #include "accessors.h"
++#include "raid56.h"
+ 
+ /*
+  * Structure name                       Path
+@@ -520,12 +521,39 @@ static const struct attribute *discard_attrs[] = {
+ 
+ #ifdef CONFIG_BTRFS_DEBUG
+ 
++/* The raid56 stripe cache limit (raid56.c), 0 to disable the cache. */
++static ssize_t btrfs_rbio_cache_size_show(struct kobject *kobj,
++                                        struct kobj_attribute *a, char *buf)
++{
++      struct btrfs_fs_info *fs_info = to_fs_info(get_btrfs_kobj(kobj));
++
++      return sysfs_emit(buf, "%u\n", READ_ONCE(fs_info->rbio_cache_size));
++}
++
++static ssize_t btrfs_rbio_cache_size_store(struct kobject *kobj,
++                                         struct kobj_attribute *a,
++                                         const char *buf, size_t len)
++{
++      struct btrfs_fs_info *fs_info = to_fs_info(get_btrfs_kobj(kobj));
++      unsigned int val;
++      int ret;
++
++      ret = kstrtouint(buf, 10, &val);
++      if (ret)
++              return ret;
++      btrfs_set_rbio_cache_size(fs_info, val);
++      return len;
++}
++BTRFS_ATTR_RW(debug_mount, rbio_cache_size, btrfs_rbio_cache_size_show,
++            btrfs_rbio_cache_size_store);
++
+ /*
+  * Per-filesystem runtime debugging exported via sysfs.
+  *
+  * Path: /sys/fs/btrfs/UUID/debug/
+  */
+ static const struct attribute *btrfs_debug_mount_attrs[] = {
++      BTRFS_ATTR_PTR(debug_mount, rbio_cache_size),
+       NULL,
+ };
+ 
+-- 
+2.47.3
+
diff --git a/topics/raid56-fixes/0012-btrfs-raid56-no-RMW-write-back-of-repaired-sectors-a.patch b/topics/raid56-fixes/0012-btrfs-raid56-no-RMW-write-back-of-repaired-sectors-a.patch
deleted file mode 100644 (file)
index 2e277c9..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-From a5de3170c464978f18f53af4f66d4f5f31594596 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 22 Oct 2026 14:32:16 -0400
-Subject: [PATCH 12/13] btrfs: raid56: no RMW write-back of repaired sectors
- after an abort
-To: linux-btrfs@vger.kernel.org
-
-A sub-stripe write writes back the sectors its read phase repaired
-("btrfs: raid56: write back the sectors a sub-stripe write repaired").
-Data writeback can still reach the RAID56 layer after a transaction
-abort, and the write-back would then repair other sectors of the full
-stripe on disk after the abort.  Read repair does not write back on a
-read-only filesystem or after an abort or another filesystem error;
-do the same here.  The sub-stripe write itself is unchanged, and the
-repaired sectors stay stale on disk as they were before the write-back
-existed.
-
-Fixes: 95d142c556b5 ("btrfs: raid56: write back the sectors a sub-stripe write repaired")
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/raid56.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 5732c2d8ea359..be0addae72928 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -2860,9 +2860,18 @@ static bool rmw_repair_verified(struct btrfs_raid_bio *rbio, int stripe_nr,
-  */
- static unsigned long *rmw_repaired_sectors(struct btrfs_raid_bio *rbio)
- {
-+      struct btrfs_fs_info *fs_info = rbio->bioc->fs_info;
-       unsigned long *repaired = NULL;
-       int total_sector_nr;
- 
-+      /*
-+       * No repair writes on a read-only filesystem, nor after a transaction
-+       * abort or another filesystem error, as for read repair.
-+       */
-+      if (unlikely(sb_rdonly(fs_info->sb) || BTRFS_FS_ERROR(fs_info) ||
-+                   test_bit(BTRFS_FS_STATE_TRANS_ABORTED, &fs_info->fs_state)))
-+              return NULL;
-+
-       for_each_set_bit(total_sector_nr, rbio->error_bitmap, rbio->nr_sectors) {
-               const int stripe = total_sector_nr / rbio->stripe_nsectors;
-               const int sectornr = total_sector_nr % rbio->stripe_nsectors;
--- 
-2.47.3
-
diff --git a/topics/raid56-fixes/0013-DO-NOT-UPSTREAM-btrfs-raid56-debug-knob-for-the-rbio.patch b/topics/raid56-fixes/0013-DO-NOT-UPSTREAM-btrfs-raid56-debug-knob-for-the-rbio.patch
deleted file mode 100644 (file)
index 5e9fa99..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-From a3629b15df8728a96adce866b6411d73000db1fb Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 1 Oct 2026 03:54:55 -0400
-Subject: [PATCH 13/13] DO-NOT-UPSTREAM: btrfs: raid56: debug knob for the rbio
- stripe cache size
-To: linux-btrfs@vger.kernel.org
-
-Test fixture, not for submission.  A read-modify-write whose stripe is
-still in the rbio stripe cache takes the other strips from memory instead
-of reading them, so a test that injects faults into reads (dm-stripfault)
-cannot reach the RMW read path for recently written stripes.
-
-With CONFIG_BTRFS_DEBUG, /sys/fs/btrfs/<uuid>/debug/rbio_cache_size
-replaces the RBIO_CACHE_SIZE limit (default unchanged, 1024); 0 disables
-the cache.  Lowering it empties the cache, and the prune in cache_rbio()
-now loops so a lowered limit holds.
-
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/fs.h     |  4 ++++
- fs/btrfs/raid56.c | 41 ++++++++++++++++++++++++++++++++++++++---
- fs/btrfs/raid56.h |  3 +++
- fs/btrfs/sysfs.c  | 28 ++++++++++++++++++++++++++++
- 4 files changed, 73 insertions(+), 3 deletions(-)
-
-diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
-index 2dd167c32d612..326a54601289c 100644
---- a/fs/btrfs/fs.h
-+++ b/fs/btrfs/fs.h
-@@ -635,6 +635,10 @@ struct btrfs_fs_info {
-        * trying to mod the same stripe at the same time.
-        */
-       struct btrfs_stripe_hash_table *stripe_hash_table;
-+#ifdef CONFIG_BTRFS_DEBUG
-+      /* Size limit of the rbio stripe cache (debug/rbio_cache_size). */
-+      unsigned int rbio_cache_size;
-+#endif
- 
-       /*
-        * This protects the ordered operations list only while we are
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index be0addae72928..2fd869dd50495 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -198,6 +198,9 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info)
-       struct btrfs_stripe_hash *h;
-       unsigned int num_entries = 1U << BTRFS_STRIPE_HASH_TABLE_BITS;
- 
-+#ifdef CONFIG_BTRFS_DEBUG
-+      WRITE_ONCE(info->rbio_cache_size, RBIO_CACHE_SIZE);
-+#endif
-       if (info->stripe_hash_table)
-               return 0;
- 
-@@ -601,6 +604,23 @@ static void btrfs_clear_rbio_cache(struct btrfs_fs_info *info)
-       spin_unlock(&table->cache_lock);
- }
- 
-+#ifdef CONFIG_BTRFS_DEBUG
-+/*
-+ * Test knob (debug/rbio_cache_size): with a small or zero limit, a
-+ * read-modify-write cannot take its stripe from the cache and must read it,
-+ * which is what a fault-injecting test needs to see.  Lowering it empties the
-+ * cache, so the new limit holds from the next rbio on.
-+ */
-+void btrfs_set_rbio_cache_size(struct btrfs_fs_info *info, unsigned int size)
-+{
-+      unsigned int old = READ_ONCE(info->rbio_cache_size);
-+
-+      WRITE_ONCE(info->rbio_cache_size, size);
-+      if (size < old && info->stripe_hash_table)
-+              btrfs_clear_rbio_cache(info);
-+}
-+#endif
-+
- /*
-  * remove all cached entries and free the hash table
-  * used by unmount
-@@ -625,12 +645,25 @@ void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info)
-  * If the size of the rbio cache is too big, we
-  * prune an item.
-  */
-+/* How many rbios the stripe cache keeps (0: none). */
-+static unsigned int rbio_cache_limit(const struct btrfs_fs_info *fs_info)
-+{
-+#ifdef CONFIG_BTRFS_DEBUG
-+      return READ_ONCE(fs_info->rbio_cache_size);
-+#else
-+      return RBIO_CACHE_SIZE;
-+#endif
-+}
-+
- static void cache_rbio(struct btrfs_raid_bio *rbio)
- {
-       struct btrfs_stripe_hash_table *table;
-+      const unsigned int limit = rbio_cache_limit(rbio->bioc->fs_info);
- 
-       if (!test_bit(RBIO_CACHE_READY_BIT, &rbio->flags))
-               return;
-+      if (!limit)
-+              return;
- 
-       table = rbio->bioc->fs_info->stripe_hash_table;
- 
-@@ -650,15 +683,17 @@ static void cache_rbio(struct btrfs_raid_bio *rbio)
- 
-       spin_unlock(&rbio->bio_list_lock);
- 
--      if (table->cache_size > RBIO_CACHE_SIZE) {
-+      /* A loop, not one eviction: the limit can have been lowered. */
-+      while (table->cache_size > limit) {
-               struct btrfs_raid_bio *found;
- 
-               found = list_last_entry(&table->stripe_cache,
-                                       struct btrfs_raid_bio,
-                                       stripe_cache);
- 
--              if (found != rbio)
--                      __remove_rbio_from_cache(found);
-+              if (found == rbio)
-+                      break;
-+              __remove_rbio_from_cache(found);
-       }
- 
-       spin_unlock(&table->cache_lock);
-diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h
-index c7c4b0db61f4c..8d28e2a77c62b 100644
---- a/fs/btrfs/raid56.h
-+++ b/fs/btrfs/raid56.h
-@@ -295,6 +295,9 @@ void raid56_parity_cache_data_folios(struct btrfs_raid_bio *rbio,
- 
- int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info);
- void btrfs_free_stripe_hash_table(struct btrfs_fs_info *info);
-+#ifdef CONFIG_BTRFS_DEBUG
-+void btrfs_set_rbio_cache_size(struct btrfs_fs_info *info, unsigned int size);
-+#endif
- void btrfs_raid56_uncache_range(struct btrfs_fs_info *info, u64 start, u64 len);
- 
- #endif
-diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
-index 3ac1fa608d3b5..78688c36f8b02 100644
---- a/fs/btrfs/sysfs.c
-+++ b/fs/btrfs/sysfs.c
-@@ -25,6 +25,7 @@
- #include "misc.h"
- #include "fs.h"
- #include "accessors.h"
-+#include "raid56.h"
- 
- /*
-  * Structure name                       Path
-@@ -520,12 +521,39 @@ static const struct attribute *discard_attrs[] = {
- 
- #ifdef CONFIG_BTRFS_DEBUG
- 
-+/* The raid56 stripe cache limit (raid56.c), 0 to disable the cache. */
-+static ssize_t btrfs_rbio_cache_size_show(struct kobject *kobj,
-+                                        struct kobj_attribute *a, char *buf)
-+{
-+      struct btrfs_fs_info *fs_info = to_fs_info(get_btrfs_kobj(kobj));
-+
-+      return sysfs_emit(buf, "%u\n", READ_ONCE(fs_info->rbio_cache_size));
-+}
-+
-+static ssize_t btrfs_rbio_cache_size_store(struct kobject *kobj,
-+                                         struct kobj_attribute *a,
-+                                         const char *buf, size_t len)
-+{
-+      struct btrfs_fs_info *fs_info = to_fs_info(get_btrfs_kobj(kobj));
-+      unsigned int val;
-+      int ret;
-+
-+      ret = kstrtouint(buf, 10, &val);
-+      if (ret)
-+              return ret;
-+      btrfs_set_rbio_cache_size(fs_info, val);
-+      return len;
-+}
-+BTRFS_ATTR_RW(debug_mount, rbio_cache_size, btrfs_rbio_cache_size_show,
-+            btrfs_rbio_cache_size_store);
-+
- /*
-  * Per-filesystem runtime debugging exported via sysfs.
-  *
-  * Path: /sys/fs/btrfs/UUID/debug/
-  */
- static const struct attribute *btrfs_debug_mount_attrs[] = {
-+      BTRFS_ATTR_PTR(debug_mount, rbio_cache_size),
-       NULL,
- };
- 
--- 
-2.47.3
-
index f72872cb39e0ea1e98d0ed64b6b8306d474d6de5..f07a1806c924a6da3c9cbb09ca1451ad3ec2b6e7 100644 (file)
@@ -1,7 +1,7 @@
-From c2a23411b4c71e3359639de7b8af9e2e502e40d7 Mon Sep 17 00:00:00 2001
+From 9736ec0710971ca14f5204fe604a209766fb9466 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 22 Oct 2026 18:47:42 -0400
-Subject: [PATCH 0/5] btrfs: read repair and scrub after a transaction abort
+Date: Thu, 22 Oct 2026 21:41:32 -0400
+Subject: [PATCH 0/4] btrfs: read repair and scrub after a transaction abort
 To: linux-btrfs@vger.kernel.org
 
 After a transaction abort, read repair crashes, returns -EIO although a
@@ -33,11 +33,11 @@ shutdown never sets SB_RDONLY, and neither do mount-time errors.  A new
 helper also checks the error and abort states; it covers data and tree
 block repair.
 
-Patches 4 and 5 do the same for scrub's read-repair write-back and for
-raid56 parity scrub, which never checked the filesystem state: after an
-abort that is not a commit, a running scrub went on repairing through
-every remaining block group.  The dev-replace target copy is unchanged.
-Patch 5 is raid56 and so carries no stable tag.
+Patch 4 does the same for scrub's read-repair write-back, which never
+checked the filesystem state: after an abort that is not a commit, a
+running scrub went on repairing through every remaining block group.
+raid56 parity scrub, the raid56 RMW write-back and the dev-replace target
+copy are unchanged.
 
 Tested on misc-next and 6.18, KASAN kernels.  A write detector counts
 every write, discard and flush to the member devices from the abort to
@@ -58,20 +58,17 @@ Not addressed: data writeback of pages dirtied before an abort still
 reaches the disks (2-4 writes on every kernel tested).  A shutdown blocks
 it; an abort does not.
 
-Zygo Blaxell (5):
+Zygo Blaxell (4):
   btrfs: give the read repair bio an end_io for submit failures
   btrfs: look up a repair read's csums in the same root as the failed
     read
   btrfs: do not write back a read repair after a transaction abort
   btrfs: scrub: do not write back repairs after a transaction abort
-  btrfs: raid56: do not write back parity scrub repairs after a
-    transaction abort
 
- fs/btrfs/bio.c    | 31 +++++++++++++++++++++++++++++--
- fs/btrfs/fs.h     | 13 +++++++++++++
- fs/btrfs/raid56.c |  7 +++++++
- fs/btrfs/scrub.c  |  6 +++++-
- 4 files changed, 54 insertions(+), 3 deletions(-)
+ fs/btrfs/bio.c   | 31 +++++++++++++++++++++++++++++--
+ fs/btrfs/fs.h    | 13 +++++++++++++
+ fs/btrfs/scrub.c |  6 +++++-
+ 3 files changed, 47 insertions(+), 3 deletions(-)
 
 
 base-commit: 0c48d26d46bdd6422bb91ba7f1c519a2993116dc
index 28bee427b648143f540dbaad1fea030bb7a9a7f5..01e0bd0230b426294f72c5785c7ef8c8958944ff 100644 (file)
@@ -1,7 +1,7 @@
 From a0d12f2d99a3c84f17228e42e6b0c0c99a798711 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 02:16:13 -0400
-Subject: [PATCH 1/5] btrfs: give the read repair bio an end_io for submit
+Subject: [PATCH 1/4] btrfs: give the read repair bio an end_io for submit
  failures
 To: linux-btrfs@vger.kernel.org
 
index 8925c524a5236a0ad943637290e0f5630cf93b60..4925850622b6e86da2d1f9c5e192067f766368c4 100644 (file)
@@ -1,7 +1,7 @@
 From 49af9ece472850eaf172378e92763600c4792be9 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 14:31:46 -0400
-Subject: [PATCH 2/5] btrfs: look up a repair read's csums in the same root as
+Subject: [PATCH 2/4] btrfs: look up a repair read's csums in the same root as
  the failed read
 To: linux-btrfs@vger.kernel.org
 
index 1f10531eb52c48e08a454fa70206f4176a4cbc37..e15339ba40626487b148c9aefd78a351e5a00e3b 100644 (file)
@@ -1,7 +1,7 @@
 From 96c712193047ea097b1270e9fdea7685966a49d4 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 14:31:48 -0400
-Subject: [PATCH 3/5] btrfs: do not write back a read repair after a
+Subject: [PATCH 3/4] btrfs: do not write back a read repair after a
  transaction abort
 To: linux-btrfs@vger.kernel.org
 
index 8555701b91627705e2eec7ccc5640e2b3cee8da8..092f7767c8f0305e477b8dd77fedcece5244855a 100644 (file)
@@ -1,7 +1,7 @@
 From 9736ec0710971ca14f5204fe604a209766fb9466 Mon Sep 17 00:00:00 2001
 From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
 Date: Thu, 22 Oct 2026 14:31:49 -0400
-Subject: [PATCH 4/5] btrfs: scrub: do not write back repairs after a
+Subject: [PATCH 4/4] btrfs: scrub: do not write back repairs after a
  transaction abort
 To: linux-btrfs@vger.kernel.org
 
diff --git a/topics/read-repair-fixes/0005-btrfs-raid56-do-not-write-back-parity-scrub-repairs-.patch b/topics/read-repair-fixes/0005-btrfs-raid56-do-not-write-back-parity-scrub-repairs-.patch
deleted file mode 100644 (file)
index 09f17e7..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-From c2a23411b4c71e3359639de7b8af9e2e502e40d7 Mon Sep 17 00:00:00 2001
-From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
-Date: Thu, 22 Oct 2026 14:31:49 -0400
-Subject: [PATCH 5/5] btrfs: raid56: do not write back parity scrub repairs
- after a transaction abort
-To: linux-btrfs@vger.kernel.org
-
-A RAID56 parity scrub writes the parity it finds wrong back to the
-device in finish_parity_scrub(), without looking at the filesystem
-state.  A scrub keeps running after a transaction abort outside the
-commit path (see the previous patch), so these writes can go out after
-the abort, to a filesystem that was forced read-only.
-
-Skip the writes to the scrubbed stripe when
-btrfs_can_submit_repair_write() says no.  A running dev-replace still
-gets the parity copied to its target, which __btrfs_handle_fs_error()
-leaves running on purpose.
-
-Not covered by a dedicated test: read-repair-submit-fail-test.sh
-RR_ARM=scrubabort exercises the non-parity scrub repair on raid1.
-
-Fixes: 5a6ac9eacb49 ("Btrfs, raid56: support parity scrub on raid56")
-Assisted-by: Claude:claude-opus-5-5
----
- fs/btrfs/raid56.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
-index 5ec31299f1c30..c5a2d12956aeb 100644
---- a/fs/btrfs/raid56.c
-+++ b/fs/btrfs/raid56.c
-@@ -2774,7 +2774,13 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-        * time to start writing.  Make bios for everything from the
-        * higher layers (the bio_list in our rbio) and our p/q.  Ignore
-        * everything else.
-+       *
-+       * No parity is repaired after a transaction abort or another
-+       * filesystem error.  A running replace still gets the parity copied
-+       * to its target.
-        */
-+      if (unlikely(!btrfs_can_submit_repair_write(rbio->bioc->fs_info)))
-+              goto replace;
-       for_each_set_bit(sectornr, &rbio->dbitmap, rbio->stripe_nsectors) {
-               phys_addr_t *paddrs;
- 
-@@ -2785,6 +2791,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio)
-                       goto cleanup;
-       }
- 
-+replace:
-       if (!is_replace)
-               goto submit_write;
- 
--- 
-2.47.3
-
index b4bfd03ce2c98fbd4cbb58d5751c8453fe3d6c6c..36704012b9c171dfc03498ce77845c342abbdda7 100644 (file)
@@ -109,7 +109,7 @@ tolerance corruption on raid6 data and raid1c3 metadata must be read back
 intact, detected, and repaired by scrub.  It covers the normal repair path
 the patch touches (repair bios that submit cleanly), not the failure path.
 
-## Follow-up patches 2-5 (s-repair; promoted 2026-10-22: misc-next topic c2a23411b4c7, zb64 aee0ffb1fba5; 6.18 topic a9fe36da2539, zb64 8fcf012e67b0.  The raid56 RMW write-back guard is raid56-fixes patch 12.)
+## Follow-up patches 2-5 (s-repair; promoted 2026-10-22: misc-next topic c2a23411b4c7, zb64 aee0ffb1fba5; 6.18 topic a9fe36da2539, zb64 8fcf012e67b0.  Zygo 10-22: the abort rule is under revision upstream, so raid56 stays as upstream; P4b (parity scrub) and the raid56-fixes RMW guard were dropped: misc-next topic 9736ec071097, zb64 d80f06194759; 6.18 topic 949e59762373, zb64 ceca39cf50b0.  Rows naming P4b or R56 describe kernels that had them.)
 
 Zygo's rule (2026-10-22): no writes after an abort, repair writes
 included; a read may use the commit root to repair in memory but must not