From: Boyang Xue <bxue@xxxxxxxxxx> Regression test for: e905fbe3fd0f ext4: Fix tune2fs checksum failure for mounted filesystem This test runs "tune2fs -l" after ext4 shutdown. tune2fs reads superblock checksum from the buffer cache. On unfixed kernels, the checksum is incorrect until the writeout happens, so tune2fs fails with "superblock checksum does not match" in this case. Signed-off-by: Boyang Xue <bxue@xxxxxxxxxx> --- Hi, This is the v2 of the test. I have fixed various errors in this version according to comments for v1. Hope I'm not missing anything here. Please help review it. Thanks! JFYI, I paste the test log here: On good kernel ``` [root@kvm101 repo_xfstests]# ./check ext4/309 FSTYP -- ext4 PLATFORM -- Linux/x86_64 kvm101 4.18.0-305.el8.x86_64 #1 SMP Mon Aug 16 15:20:14 EDT 2021 MKFS_OPTIONS -- -b 1024 /dev/vda2 MOUNT_OPTIONS -- -o rw,relatime,seclabel -o context=system_u:object_r:root_t:s0 /dev/vda2 /scratch ext4/309 1s ... 1s Ran: ext4/309 Passed all 1 tests [root@kvm101 repo_xfstests]# cat results/ext4/309.out.bad cat: results/ext4/309.out.bad: No such file or directory [root@kvm101 repo_xfstests]# cat results/ext4/309.full tune2fs 1.45.6 (20-Mar-2020) Filesystem volume name: <none> Last mounted on: /scratch Filesystem UUID: f1ffdc35-a925-4007-99ab-b8f3bdec21cd ``` On bad kerenel ``` [root@kvm102 repo_xfstests]# ./check ext4/309 FSTYP -- ext4 PLATFORM -- Linux/x86_64 kvm102 5.14.0-0.rc4.35.xx.x86_64 #1 SMP Tue Aug 3 13:02:44 EDT 2021 MKFS_OPTIONS -- -b 1024 /dev/vda3 MOUNT_OPTIONS -- -o acl,user_xattr -o context=system_u:object_r:root_t:s0 /dev/vda3 /scratch ext4/309 - output mismatch (see /root/repo_xfstests/results//ext4/309.out.bad) --- tests/ext4/309.out 2021-08-19 05:02:40.188366781 -0400 +++ /root/repo_xfstests/results//ext4/309.out.bad 2021-08-19 08:02:47.902366781 -0400 @@ -1,2 +1,4 @@ QA output created by 309 Silence is golden +/usr/sbin/tune2fs: Superblock checksum does not match superblock while trying to open /dev/vda3 +Couldn't find valid filesystem superblock. ... (Run 'diff -u /root/repo_xfstests/tests/ext4/309.out /root/repo_xfstests/results//ext4/309.out.bad' to see the entire diff) Ran: ext4/309 Failures: ext4/309 Failed 1 of 1 tests [root@kvm102 repo_xfstests]# cat results/ext4/309.out.bad QA output created by 309 Silence is golden /usr/sbin/tune2fs: Superblock checksum does not match superblock while trying to open /dev/vda3 Couldn't find valid filesystem superblock. [root@kvm102 repo_xfstests]# cat results/ext4/309.full tune2fs 1.46.2 (28-Feb-2021) ``` -Boyang tests/ext4/309 | 29 +++++++++++++++++++++++++++++ tests/ext4/309.out | 2 ++ 2 files changed, 31 insertions(+) create mode 100755 tests/ext4/309 create mode 100644 tests/ext4/309.out diff --git a/tests/ext4/309 b/tests/ext4/309 new file mode 100755 index 00000000..8594d264 --- /dev/null +++ b/tests/ext4/309 @@ -0,0 +1,29 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2021 Red Hat Inc. All Rights Reserved. +# +# FS QA Test 309 +# +# Test that tune2fs doesn't fail after ext4 shutdown +# Regression test for commit: +# e905fbe3fd0f ext4: Fix tune2fs checksum failure for mounted filesystem +# +. ./common/preamble +_begin_fstest auto rw quick + +# real QA test starts here +_supported_fs ext4 +_require_scratch +_require_scratch_shutdown +_require_command "$TUNE2FS_PROG" tune2fs + +echo "Silence is golden" + +_scratch_mkfs >/dev/null 2>&1 +_scratch_mount +echo "This is a test" > $SCRATCH_MNT/testfile +_scratch_shutdown +_scratch_cycle_mount +$TUNE2FS_PROG -l $SCRATCH_DEV >> $seqres.full +status=0 +exit diff --git a/tests/ext4/309.out b/tests/ext4/309.out new file mode 100644 index 00000000..56330d65 --- /dev/null +++ b/tests/ext4/309.out @@ -0,0 +1,2 @@ +QA output created by 309 +Silence is golden -- 2.27.0