diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-01-11 13:50:30 -0800 |
---|---|---|
committer | Eryu Guan <guaneryu@gmail.com> | 2022-01-16 13:00:58 +0800 |
commit | 9ecf4cbf3c372f77e8d61af22ac0017425ab9547 (patch) | |
tree | ef0db686c9d9b1690807dacb7b7106d4a471da80 | |
parent | 3925a4ec9d478e87ac242cdffc243b86de5a08aa (diff) | |
download | xfstests-dev-9ecf4cbf3c372f77e8d61af22ac0017425ab9547.tar.gz |
xfs: test fixes for new 5.17 behaviors
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>
-rw-r--r-- | common/xfs | 12 | ||||
-rwxr-xr-x | tests/xfs/130 | 6 | ||||
-rw-r--r-- | tests/xfs/130.out | 1 | ||||
-rwxr-xr-x | tests/xfs/308 | 5 | ||||
-rw-r--r-- | tests/xfs/308.out | 2 |
5 files changed, 19 insertions, 7 deletions
diff --git a/common/xfs b/common/xfs index bfb1bf1eae..713e9fe78d 100644 --- a/common/xfs +++ b/common/xfs @@ -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. diff --git a/tests/xfs/130 b/tests/xfs/130 index 0eb7d9c092..9465cbb099 100755 --- a/tests/xfs/130 +++ b/tests/xfs/130 @@ -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" \ diff --git a/tests/xfs/130.out b/tests/xfs/130.out index a0eab98772..6ca21ad6cb 100644 --- a/tests/xfs/130.out +++ b/tests/xfs/130.out @@ -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 diff --git a/tests/xfs/308 b/tests/xfs/308 index de5ee5c11c..d0f47f5038 100755 --- a/tests/xfs/308 +++ b/tests/xfs/308 @@ -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 diff --git a/tests/xfs/308.out b/tests/xfs/308.out index bea1de81bc..383cd07e9d 100644 --- a/tests/xfs/308.out +++ b/tests/xfs/308.out @@ -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 |