From: Darrick J. Wong <djwong@xxxxxxxxxx> 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@xxxxxxxxxx> --- common/xfs | 12 ++++++++++++ tests/xfs/130 | 6 +++++- tests/xfs/130.out | 1 + tests/xfs/308 | 5 +---- tests/xfs/308.out | 2 -- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/common/xfs b/common/xfs index bfb1bf1e..713e9fe7 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 0eb7d9c0..9465cbb0 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 a0eab987..6ca21ad6 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 de5ee5c1..d0f47f50 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 bea1de81..383cd07e 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