From: Qu Wenruo <wqu@suse.com>
To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: [PATCH] fstests: generic/362: remove the old file to reflect new mount options
Date: Tue, 26 May 2026 16:30:55 +0930 [thread overview]
Message-ID: <20260526070055.60193-1-wqu@suse.com> (raw)
[HIDDEN BUG]
There is a btrfs bug that will only trigger on newly formated TEST_DEV,
with mount option "nodatasum":
FSTYP -- btrfs
PLATFORM -- Linux/x86_64 btrfs-vm 7.1.0-rc4-custom+ #381 SMP PREEMPT_DYNAMIC Tue May 26 10:47:14 ACST 2026
MKFS_OPTIONS -- -O bgt -K /dev/mapper/test-scratch1
MOUNT_OPTIONS -- -o nodatasum /dev/mapper/test-scratch1 /mnt/scratch
generic/362 0s ... - output mismatch (see /home/adam/xfstests/results//generic/362.out.bad)
--- tests/generic/362.out 2024-08-24 15:31:37.200000000 +0930
+++ /home/adam/xfstests/results//generic/362.out.bad 2026-05-26 16:24:40.201201849 +0930
@@ -1,2 +1,3 @@
QA output created by 362
+First write failed: Input/output error
Silence is golden
...
(Run 'diff -u /home/adam/xfstests/tests/generic/362.out /home/adam/xfstests/results//generic/362.out.bad' to see the entire diff)
But if one has formated TEST_DEV, run test with default mount option,
then change the mount option to "nodatasum", the test will not fail
anymore:
FSTYP -- btrfs
PLATFORM -- Linux/x86_64 btrfs-vm 7.1.0-rc4-custom+ #381 SMP PREEMPT_DYNAMIC Tue May 26 10:47:14 ACST 2026
MKFS_OPTIONS -- -O bgt -K /dev/mapper/test-scratch1
MOUNT_OPTIONS -- /dev/mapper/test-scratch1 /mnt/scratch
generic/362 0s ... 0s
Ran: generic/362
Passed all 1 tests
FSTYP -- btrfs
PLATFORM -- Linux/x86_64 btrfs-vm 7.1.0-rc4-custom+ #381 SMP PREEMPT_DYNAMIC Tue May 26 10:47:14 ACST 2026
MKFS_OPTIONS -- -O bgt -K /dev/mapper/test-scratch1
MOUNT_OPTIONS -- -o nodatasum /dev/mapper/test-scratch1 /mnt/scratch
generic/362 0s ... 0s
Ran: generic/362
Passed all 1 tests
[CAUSE]
Btrfs' nodatasum mount option only affect new files, but the test case
itself is using TEST_DEV, and never delete the file
"$TEST_DIR/dio-append-buf-fault"
So if the file is created with default mount option, then all later
"nodatasum" mount option will not affect that file, thus hide the test
failure.
[FIX]
Always delete the target file "$TEST_DIR/dio-append-buf-fault" before
running dio-append-buf-fault command.
So that the new target file is always newly created and will follow
btrfs' new mount option and expose the failure for nodatasum.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
I'm already looking into the test failure, because it's mostly hidden by
the btrfs' falling back to buffered IO behavior.
With the incoming IOMAP_DIO_BOUNCE usage inside btrfs, it will expose
the failure unconditionally.
---
tests/generic/362 | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/generic/362 b/tests/generic/362
index 0cfaa726..86191e57 100755
--- a/tests/generic/362
+++ b/tests/generic/362
@@ -20,6 +20,10 @@ _require_test_program dio-append-buf-fault
_fixed_by_fs_commit btrfs 939b656bc8ab \
"btrfs: fix corruption after buffer fault in during direct IO append write"
+# Remove the existing file, so a new inode can be created, and will be
+# affected by changed mount options.
+rm -rf $TEST_DIR/dio-append-buf-fault
+
# On error the test program writes messages to stderr, causing a golden output
# mismatch and making the test fail.
$here/src/dio-append-buf-fault $TEST_DIR/dio-append-buf-fault
--
2.51.2
next reply other threads:[~2026-05-26 7:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 7:00 Qu Wenruo [this message]
2026-05-27 6:34 ` [PATCH] fstests: generic/362: remove the old file to reflect new mount options Christoph Hellwig
2026-05-27 6:50 ` Qu Wenruo
2026-05-27 13:03 ` Christoph Hellwig
2026-05-27 21:42 ` Qu Wenruo
2026-05-29 9:02 ` Zorro Lang
2026-05-27 14:26 ` Filipe Manana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260526070055.60193-1-wqu@suse.com \
--to=wqu@suse.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox