on older kernels with conflicting flags set would reject changes to almost
any inode attribute, even the ones not related to compression or datacow.
-Patch 2 closes the other way to get the combination patch 1
-refuses: inode creation. A file created in a directory with chattr +c on
-a filesystem mounted with -o nodatacow inherits COMPRESS from the
-directory and gets NODATACOW from the mount option; a directory that
-already carries both (set by an old kernel) passes both to every new
-inode. NODATACOW now wins: COMPRESS is dropped when NODATACOW is set at
-creation. NOCOMPRESS is left alone.
+Patch 2 is Filipe Manana's "btrfs: dont propagate nodatacow mount
+option on files with inherited compression" (Reviewed-by: Qu Wenruo), as
+posted. It is already in btrfs/for-next (75d0e4dd64f2a) but not in this
+series' base; "git am --skip" drops it. It closes the other way to get
+the combination patch 1 refuses: inode creation. A file created in a
+directory with chattr +c on a filesystem mounted with -o nodatacow
+inherited COMPRESS from the directory and got NODATACOW from the mount
+option. The inherited COMPRESS now wins: the file is not given
+NODATACOW or NODATASUM, and its data is compressed. It replaces a patch
+of our own that did the opposite (dropped COMPRESS and kept NODATACOW).
+That patch also dropped COMPRESS when the parent directory itself
+already carries both flags (only an old kernel could set that); that
+part is gone with it and has no replacement, so such a directory still
+passes both flags to new files, as upstream does. Patch 1 keeps those
+files' flags editable.
Patch 3 removes the artificial conflict between NODATACOW and NOCOMPRESS,
introduced by f37c563bab42 and extended by 0e852ab8974c
regressions of patch 1, strict property values, and the inheritance case
above) passes on the misc-next and 6.18 test kernels with the series and
fails on a misc-next base without it exactly in the cases the series
-changes; the inheritance case fails on both lanes without patch 2.
+changes. Its inheritance cases (the new file is "c", not "C"; chattr +A
+on it works; FIEMAP shows its data encoded, as fstests btrfs/364 checks)
+fail with our old patch 2 and pass with Filipe's.
fstests btrfs/349 (levels) and btrfs/350 (flag matrix, not upstream yet)
pass with the series.
-Zygo Blaxell (5):
+Filipe Manana (1):
+ btrfs: dont propagate nodatacow mount option on files with inherited
+ compression
+
+Zygo Blaxell (4):
btrfs: fix nodatacow vs compression inode flag conflict check
- btrfs: do not leave COMPRESS on an inode that gets NODATACOW at
- creation
btrfs: allow NODATACOW | NOCOMPRESS
btrfs: props: add per-inode compression level support
btrfs: props: validate compression property values strictly
fs/btrfs/btrfs_inode.h | 7 +++
- fs/btrfs/inode.c | 11 +++-
+ fs/btrfs/inode.c | 23 +++++++---
fs/btrfs/ioctl.c | 78 ++++++++++++++++++++--------
fs/btrfs/props.c | 113 +++++++++++++++++++++++++++++++++++++++--
fs/btrfs/props.h | 3 ++
- 5 files changed, 184 insertions(+), 28 deletions(-)
+ 5 files changed, 192 insertions(+), 32 deletions(-)
-base-commit: bf921b86bdf225f19ffd41533f5c779fba99012e
+base-commit: 83cd81353093be02aa7e60874c413ec340e55bce
--
2.47.3
`fixtures/compress-legacy-nocow-compr.img.zst`, a 256M image whose
`legacy-dir/l1..l3` carry NOCOW|COMPR, made on #5 (harness c439612).
+## rb1103 (2026-11-03): Filipe Manana's patch replaces patch 2
+
+Zygo, 2026-11-03: follow Filipe. Patch 2 is now Filipe Manana's "btrfs:
+dont propagate nodatacow mount option on files with inherited compression"
+(Reviewed-by Qu Wenruo, as posted). It is already in btrfs/for-next
+75d0e4dd64f2a (same patch-id) and drops at the next rebase. The rule is
+now the opposite of our patch's: a file created in a `+c` directory on a
+`-o nodatacow` mount keeps the inherited COMPRESS and gets neither
+NODATACOW nor NODATASUM. Our hunk in btrfs_inherit_iflags() went with
+our patch and has no replacement: a parent directory that already carries
+NODATACOW|COMPRESS (made by an old kernel) passes both flags on, as
+upstream does. The "patch 2, promoted 2026-10-19" text and the
+candidate rows above describe the dropped patch.
+
+compress-props-test.sh inherit phase (harness f362735b): I1 the new file
+is "c", not "C" (and not "cC"); I2 chattr +A on it (one FS_IOC_SETFLAGS
+adding NOATIME) is accepted; I3 1 MiB of compressible data plus fsync,
+and every FIEMAP extent is ENCODED (what fstests btrfs/364 checks). The
+legacy phase can no longer make NOCOW|COMPR inodes, so L1-L3 use the
+fixture image.
+
+| test | kernel | result | evidence |
+|---|---|---|---|
+| compress-props-test.sh | misc-next zb64 7f75938b139b (7.3.0+ #63, KASAN, Filipe's patch) | PASS: I1 "-c--", I2 "-c-A", I3 8/8 extents encoded; L1-L3 on the fixture pass; every flags/props/persist case passes | raid56-wh-harness `forensics/rb1103-mn/ehive/rb1103mn-cp.log` |
+| same (negative control) | misc-next zb64 00c5fbf36a40 (7.3.0+ #62, our old patch 2) | FAIL in I1-I3 only: "C---", 1 extent, 0 encoded; everything else passes | `forensics/rb1103-mn/ehive/compress-props-neg-62.log` |
+
+The 6.18 sibling ran the same negative control on 6.18 #311. Per-commit
+buildcheck of the topic: 6/6 clean. The other patches' content and
+messages are unchanged.
+
## Not covered / open
-- The candidate patch is not covered for the second source it handles (a
- parent directory that already carries NODATACOW|COMPRESS, which only an
- old kernel can create); only the mount-option source is tested.
+- (Obsolete since rb1103: the patch that handled a parent directory
+ already carrying NODATACOW|COMPRESS was dropped; that case now follows
+ upstream and passes both flags on.)
### Questions for Zygo
is silent. The pair becomes a completion.
Patch 3 is Josef Bacik's "btrfs: don't drop the error of the last split
-bio" (1/5 of his "btrfs: data integrity fixes", 2026-10-30, Reviewed-by:
-Qu Wenruo), as posted. A split bio's error was dropped when the split
+bio" (1/5 of his "btrfs: data integrity fixes" v2, 2026-11-03,
+Reviewed-by: Qu Wenruo, Reviewed-by: Filipe Manana, Tested-by: Zygo
+Blaxell), as posted; v2 changed only its commit message and tags. A split bio's error was dropped when the split
that failed was not the last to complete and the last one succeeded.
Not raid56-specific. Fixes: d48e1dea3931. It replaces our own patch
for the same bug (identical code, different comment); it is carried
shown with a kernel built to count it: 5WP then fails (B's fsync EIO; the
plain writer's B silently lost); 6PW, the only other arm run on it, passes.
+## rb1103 (2026-11-03): Josef Bacik's v2 of patch 3
+
+Patch 3 is now v2 of Josef's "btrfs: don't drop the error of the last
+split bio" (2026-11-03). The code is unchanged from v1 (same patch-id,
+same tree); only the message and tags changed (Reviewed-by Qu Wenruo and
+Filipe Manana, Tested-by Zygo Blaxell). The topic's tip tree is
+byte-identical to the rb1101 one, so nothing here was retested for this
+patch alone. Per-commit buildcheck clean (11/11). Kernel: misc-next zb64 7f75938b139b, KASAN inline + lockdep + BTRFS_ASSERT, 7.3.0+ #63, bzImage md5 ff480f5968adee691ca6e80da2c11c32; the
+rb1028-regress runner (write-error-cache 7/7, rmw-writeback,
+scrub-uncorrectable-rc, failing-member-scrub) PASSed on dhive, as in
+rb1101. Evidence: raid56-wh-harness `forensics/rb1103-mn/`.
+
## Not covered / open
- Plain writers (Zygo 2026-10-20: a write is acknowledged when write(2)
On misc-next the topic also carries, at its head and ahead of the
patches numbered here, Josef Bacik's "btrfs: don't trim the target of a
-device replace" (5/5 of "btrfs: data integrity fixes", 2026-10-30,
-Reviewed-by: Qu Wenruo), as posted, until upstream takes it: FITRIM
-during a replace discarded everything already copied to the target.
+device replace" (5/5 of "btrfs: data integrity fixes" v2, 2026-11-03,
+Reviewed-by: Qu Wenruo, Reviewed-by: Filipe Manana), as posted, until
+upstream takes it: FITRIM during a replace discarded everything already
+copied to the target. v2 changed only its commit message and tags.
Patch 1 commits the CANCELED state when a replace fails or is canceled.
btrfs_dev_replace_finishing() updated the item but did not commit, so
raid10 / dup data (same code path, not run); scrub during a replace with
discards.
+## rb1103 (2026-11-03): Josef Bacik's v2 of 5/5
+
+Josef's "btrfs: don't trim the target of a device replace" is now v2
+(2026-11-03): code unchanged (same patch-id and tree), message and tags
+refreshed (Reviewed-by Qu Wenruo and Filipe Manana). Per-commit
+buildcheck clean (12/12). Kernel: misc-next zb64 7f75938b139b, KASAN inline + lockdep + BTRFS_ASSERT, 7.3.0+ #63, bzImage md5 ff480f5968adee691ca6e80da2c11c32. ehive: replace-discard-test.sh,
+all 11 cases (the rb1101 set without dasync-raid5), PASS: fstrim-single,
+fstrim-raid1, fstrim-raid5, resume-single (0 discard sectors on the
+target), and the controls dsync-raid1/raid5, dasync-raid1,
+noK-raid1/raid5, mkfsnoK-raid1/raid5. replace-status-test.sh rc 0;
+replace-uncorrectable-test.sh rc 0 (readback eio_unexpected=0). Same as
+rb1101. Evidence: raid56-wh-harness `forensics/rb1103-mn/ehive/`.
+
## Not covered / open
- Patch 1's commit-failure branch (the commit after the cleanup fails; only
On misc-next the topic also carries, at its head and ahead of the 85
patches numbered here, three of Josef Bacik's "btrfs: data integrity
-fixes" (2026-10-30), as posted, until upstream takes them: 2/5 "btrfs:
-clear dirty blocks after a delalloc failure" (Reviewed-by: Qu Wenruo),
-3/5 "btrfs: make fsync wait after pre-submission errors" and 4/5
-"btrfs: don't report success for a skipped log sync". They fix the
-fsync and writeback error paths that a stripe_alloc ENOSPC drop at the
-fill edge goes through. 3/5 is v1 with an open race report: a Sashiko
-"Critical" finding that Qu forwarded on 2026-10-31. Every caller clears
-folio writeback before can_finish_ordered_extent() sets
-BTRFS_INODE_COW_WRITE_ERROR, so a fast fsync that runs in between still
-sees neither writeback nor the flag and can log the unwritten extent.
-The patch narrows that window and does not close it; no v2 yet.
+fixes" v2 (2026-11-03), as posted, until upstream takes them: 2/5
+"btrfs: clear dirty blocks after a delalloc failure" (Reviewed-by: Qu
+Wenruo, Reviewed-by: Filipe Manana), 3/5 "btrfs: wait for ordered extent
+IO in fast fsync" and 4/5 "btrfs: don't report success for a skipped log
+sync" (Reviewed-by: Filipe Manana). They fix the fsync and writeback
+error paths that a stripe_alloc ENOSPC drop at the fill edge goes
+through. 3/5 is reworked in v2 and answers the race report on v1 (a
+Sashiko "Critical" finding that Qu forwarded on 2026-10-31: every caller
+cleared folio writeback before BTRFS_INODE_COW_WRITE_ERROR was set, so a
+fast fsync in between could still log the unwritten extent). v2 drops
+the flag: a fast fsync waits for BTRFS_ORDERED_IO_DONE on the ordered
+extents it collected, which can_finish_ordered_extent() sets only after
+recording BTRFS_ORDERED_IOERR. In 4/5, v2 turns v1's ASSERT(0, ...)
+into DEBUG_WARN(...). 2/5 changed only its commit message and tags.
The write hole
==============
arms waited there). Limits: the reclaim worker's RO flip, the third caller,
is not driven.
+## rb1103 (2026-11-03): Josef Bacik's v2 of 2/5, 3/5, 4/5 at the topic head
+
+- 2/5: code unchanged (same patch-id and tree), new message and tags.
+- 3/5: reworked, now "btrfs: wait for ordered extent IO in fast fsync".
+ BTRFS_INODE_COW_WRITE_ERROR is gone; a fast fsync waits for
+ BTRFS_ORDERED_IO_DONE on the ordered extents it collected and checks
+ BTRFS_ORDERED_IOERR under ordered_tree_lock. It replaced v1 in place;
+ the 85 stripe_alloc commits replayed on it without a conflict, and
+ old tip -> new tip is exactly v1 -> v2 (content oracle).
+- 4/5: `ASSERT(0, ...)` became `DEBUG_WARN(...)`.
+
+Builds: per-commit buildcheck from reclaim-fixes, 89/89 clean, and
+low-space 4/4, test-knobs 3/3. The only fs/btrfs warning of the KASAN
+build is the known btrfs_sync_log() frame size (1072 bytes, as in
+rb1101). Kernel: misc-next zb64 7f75938b139b, KASAN inline + lockdep + BTRFS_ASSERT, 7.3.0+ #63, bzImage md5 ff480f5968adee691ca6e80da2c11c32.
+
+Gate on dhive (same as rb1101): rb1028-regress without qu-p1, all PASS;
+retire-wait-abort SKIP 77 as before. enospc-dataloss fsync and nofsync:
+no loss of acked data. write-error-cache 7/7 PASS.
+
+Which tests can see 3/5's window: **none**. The bug is a fast fsync that
+returns 0 after logging extents of a failed COW write, and it only shows
+when the log is replayed after a crash.
+- enospc-drop-fsync-test.sh is the only test built for that window (crash
+ image, then log replay). It was BLIND (77) on raid5 and raid6: no
+ writeback drop was reached. Same as 10-31 and rb1101.
+- write-error-cache-test.sh fails writes with dm-flakey but checks parity
+ and readback after a commit, with no fsync log replay. BLIND to the
+ window. It does exercise the error completion path that 3/5 now waits
+ on.
+- The enospc-dataloss fsync arms sync and do a clean remount, so there is
+ no log replay. BLIND to the window.
+- log-settle-unwritten-test.sh: an ordered extent ends partly truncated
+ (flags IO_DONE|COMPLETE|TRUNCATED), then a fast fsync. This is a
+ liveness check of v2's IO_DONE wait. PASS: the fsync returned, the
+ settle ran (0 -> 2), unwritten_on_end_truncated 0 -> 1. It does not
+ test write errors.
+
+So v2 3/5 is build- and regression-checked, and its wait is shown not to
+hang. Its fix is not shown by any test here. Evidence: raid56-wh-harness `forensics/rb1103-mn/dhive/`.
+
## Not covered / open
Patches without a test of their own (covered at most incidentally by the