And followed by a rw mount. Suggested-by: Donald Douwsma <ddouwsma@xxxxxxxxxx> Signed-off-by: Murphy Zhou <xzhou@xxxxxxxxxx> --- v2: Add explaination of the issue add xfs_force_bdev data $SCRATCH_MNT use DF_PROG Re numbered this test tests/xfs/999 | 61 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/999.out | 2 ++ 2 files changed, 63 insertions(+) create mode 100755 tests/xfs/999 create mode 100644 tests/xfs/999.out diff --git a/tests/xfs/999 b/tests/xfs/999 new file mode 100755 index 00000000..c93ed770 --- /dev/null +++ b/tests/xfs/999 @@ -0,0 +1,61 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2021 RedHat All Rights Reserved. +# +# FS QA Test 999 +# +# Testcase for kernel commit: +# 50d25484bebe xfs: sync lazy sb accounting on quiesce of read-only mounts +# +# After shutdown and readonly mount, a following read-write mount would +# get wrong number of available blocks. This is caused by unmounting the log +# on a readonly filesystem doesn't log the sb counters. +# +. ./common/preamble +_begin_fstest shutdown auto quick + +# real QA test starts here + +_supported_fs xfs +_require_scratch + +_scratch_mkfs > $seqres.full 2>&1 +mount $SCRATCH_DEV $SCRATCH_MNT +_xfs_force_bdev data $SCRATCH_MNT + +# Write test file +ls > $SCRATCH_MNT/testfile +$DF_PROG $SCRATCH_MNT >> $seqres.full 2>&1 + +# Shutdown +$XFS_IO_PROG -x -c "shutdown -f" $SCRATCH_MNT + +# Mount ReadOnly +_scratch_unmount +_scratch_mount -oro +$DF_PROG $SCRATCH_MNT >> $seqres.full 2>&1 +# Umount and mount rw +_scratch_unmount +_scratch_mount + +# Get fdblocks before repair +fdb1=$($DF_PROG $SCRATCH_MNT | tail -1 | $AWK_PROG '{print $4}') +_scratch_unmount + +# Repair +_repair_scratch_fs >> $seqres.full 2>&1 + +# Re-mount +_scratch_mount + +# Get fdblocks after repair +fdb2=$($DF_PROG $SCRATCH_MNT | tail -1 | $AWK_PROG '{print $4}') + +echo fdb1 $fdb1 fdb2 $fdb2 >> $seqres.full 2>&1 + +[ $fdb1 -ne $fdb2 ] && echo Wrong fdblocks: $fdb1 and $fdb2 + +# success, all done +echo "Silence is golden" +status=0 +exit diff --git a/tests/xfs/999.out b/tests/xfs/999.out new file mode 100644 index 00000000..3b276ca8 --- /dev/null +++ b/tests/xfs/999.out @@ -0,0 +1,2 @@ +QA output created by 999 +Silence is golden -- 2.20.1