xfs: test fixes for new 5.17 behaviors
authorDarrick J. Wong <djwong@kernel.org>
Tue, 11 Jan 2022 21:50:30 +0000 (13:50 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 16 Jan 2022 05:00:58 +0000 (13:00 +0800)
xfs/308 and xfs/130 are two tests that tried to mess with the refcount
btree to try to trip up the COW recovery code.  Now that we've made COW
recovery only happen during log recovery, we must adjust these tests to
force a log recovery.  Older kernels should be ok with this, since they
unconditionally try to recover COW on mount.

Add a helper function to unmount the filesystem with a dirty log and
convert the two tests to use it.  While we're at it, remove an xfs_check
test because xfs_check refuses to run on a dirty fs, and nobody cares
about xfs_check anymore.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/xfs
tests/xfs/130
tests/xfs/130.out
tests/xfs/308
tests/xfs/308.out

index bfb1bf1eae8565f9fa853027720f5db59285a160..713e9fe78de998a70715a75580aa5d1784349016 100644 (file)
@@ -776,6 +776,18 @@ _reset_xfs_sysfs_error_handling()
        done
 }
 
+# Unmount an XFS with a dirty log
+_scratch_xfs_unmount_dirty()
+{
+       local f="$SCRATCH_MNT/.dirty_umount"
+
+       rm -f "$f"
+       echo "test" > "$f"
+       sync
+       _scratch_shutdown
+       _scratch_unmount
+}
+
 # Skip if we are running an older binary without the stricter input checks.
 # Make multiple checks to be sure that there is no regression on the one
 # selected feature check, which would skew the result.
index 0eb7d9c09221ae44e28668cea63db61b569d302c..9465cbb0991d0f2784ac8b754dd3173f4613963d 100755 (executable)
@@ -44,12 +44,16 @@ _pwrite_byte 0x62 0 $((blksz * 64)) "${SCRATCH_MNT}/file0" >> "$seqres.full"
 _pwrite_byte 0x61 0 $((blksz * 64)) "${SCRATCH_MNT}/file1" >> "$seqres.full"
 _cp_reflink "${SCRATCH_MNT}/file0" "${SCRATCH_MNT}/file2"
 _cp_reflink "${SCRATCH_MNT}/file1" "${SCRATCH_MNT}/file3"
-umount "${SCRATCH_MNT}"
+_scratch_unmount
 
 echo "+ check fs"
 _scratch_xfs_repair -n >> "$seqres.full" 2>&1 || \
        _fail "xfs_repair should not fail"
 
+echo "+ force log recovery"
+_scratch_mount
+_scratch_xfs_unmount_dirty
+
 echo "+ corrupt image"
 seq 0 $((agcount - 1)) | while read ag; do
        _scratch_xfs_db -x -c "agf ${ag}" -c "agf ${ag}" -c "addr refcntroot" \
index a0eab98772926da21c5ffb69b99ad7f1a39485a7..6ca21ad6cb2cd15a89396c18d6e68dae9ceeaf21 100644 (file)
@@ -3,6 +3,7 @@ QA output created by 130
 + mount fs image
 + make some files
 + check fs
++ force log recovery
 + corrupt image
 + mount image
 + repair fs
index de5ee5c11c95fa898992114ed03207bb46e241a1..d0f47f5038e428a1af743bfb6fc9489e675de38e 100755 (executable)
@@ -23,7 +23,7 @@ echo "Format"
 _scratch_mkfs > $seqres.full 2>&1
 _scratch_mount >> $seqres.full
 is_rmap=$($XFS_INFO_PROG $SCRATCH_MNT | grep -c "rmapbt=1")
-_scratch_unmount
+_scratch_xfs_unmount_dirty
 
 _get_agf_data() {
        field="$1"
@@ -121,9 +121,6 @@ fi
 
 _dump_status "broken fs config" >> $seqres.full
 
-echo "Look for leftover warning in xfs_check"
-_scratch_xfs_check | _filter_leftover
-
 echo "Look for leftover warning in xfs_repair"
 _scratch_xfs_repair -n 2>&1 | _filter_leftover
 
index bea1de81bc8a325eca1853af2b11977723b1f55a..383cd07e9dbefe407ed77e20e36db4499ba81513 100644 (file)
@@ -4,8 +4,6 @@ We need AG1 to have a single free extent
 Find our extent and old counter values
 Remove the extent from the freesp btrees
 Add the extent to the refcount btree
-Look for leftover warning in xfs_check
-leftover CoW extent (NR/NR) len NR
 Look for leftover warning in xfs_repair
 leftover CoW extent (NR/NR) len NR
 Mount filesystem