Re: [PATCH] btrfs: test checksum handling for clone, dedupe and swap on NOCOW files
Qu Wenruo <[email protected]> Mon, 13 Jul 2026 07:31:05 +0930
| Newsgroups | org.kernel.vger.fstests,org.kernel.vger.linux-btrfs |
|---|---|
| Message-ID | <[email protected]> |
在 2026/7/13 00:07, Daan De Meyer via B4 Relay 写道: > From: Daan De Meyer <[email protected]> > > Add two tests covering how checksummed and NOCOW extents interact. > > btrfs/348 verifies that checksummed extents can be cloned and > deduplicated into NOCOW files, and that the reverse direction stays > rejected because NOCOW extents do not have checksums. I strongly doubt if you have run the test btrfs/348. As a very basic reflink clone from a datasum inode into nodatasum inode will cause btrfs check errors, with your kernel patch applied: # mkfs.btrfs -f $dev # mount $dev $mnt # xfs_io -f -c "pwrite 0 64k" -c sync $mnt/file1 # mount -o remount,nodatasum $mnt # touch $mnt/file2 # xfs_io -c "reflink $mnt/file1" $mnt/file2 # umount $mnt # btrfs check $dev Opening filesystem to check... Checking filesystem on /dev/test/scratch1 UUID: efcb3cdd-5dd9-416d-89ac-33071c59c9e7 [1/8] checking log skipped (none written) [2/8] checking root items [3/8] checking extents [4/8] checking free space tree [5/8] checking fs roots root 5 inode 258 errors 800, odd csum item ERROR: errors found in fs roots found 229376 bytes used, error(s) found > > btrfs/349 verifies that a NOCOW swap file containing a checksummed > extent is rejected even after the checksummed source is deleted and the > extent is no longer shared. > > Signed-off-by: Daan De Meyer <[email protected]> > --- > These tests cover the kernel series available at: > https://lore.kernel.org/linux-btrfs/[email protected]/ > --- > tests/btrfs/348 | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > tests/btrfs/348.out | 2 + > tests/btrfs/349 | 73 +++++++++++++++++++++ > tests/btrfs/349.out | 2 + > 4 files changed, 257 insertions(+) > > diff --git a/tests/btrfs/348 b/tests/btrfs/348 > new file mode 100755 > index 00000000..4faf994e > --- /dev/null > +++ b/tests/btrfs/348 > @@ -0,0 +1,180 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2026 Daan De Meyer. All Rights Reserved. > +# > +# FS QA Test 348 > +# > +# Verify that checksummed extents can be cloned and deduplicated into NOCOW > +# files. The reverse direction must remain rejected because NOCOW extents do > +# not have checksums. > +# > +. ./common/preamble > +_begin_fstest auto quick clone dedupe scrub > + > +. ./common/reflink > + > +_require_scratch_reflink > +_require_scratch_dedupe > +_require_chattr C > +_require_btrfs_no_nodatacow > +_require_btrfs_no_nodatasum > +_require_btrfs_command inspect-internal dump-tree > + > +_fixed_by_kernel_commit 28ce1d263f4d \ > + "btrfs: allow reflinking from checksummed files into nodatasum files" Nope, this is not a fix, nor the commit is upstreamed. A proper test case should detect older kernels and skip if it doesn't support a new feature.