Files
apfstests/tests/xfs/491
T
Darrick J. Wong 1c18b9ec2f xfs/49[12]: skip pre-lazysbcount filesystems
Prior to lazysbcount, the xfs mount code blindly trusted the value of
the fdblocks counter in the primary super, which means that the kernel
doesn't detect the fuzzed fdblocks value at all.  V4 is deprecated and
pre-lazysbcount V4 hasn't been the default for ~14 years, so we'll just
skip these two tests on those old filesystems.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2021-05-09 23:27:50 +08:00

62 lines
1.4 KiB
Bash
Executable File

#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2018 Oracle. All Rights Reserved.
#
# FS QA Test No. 491
#
# Test detection & fixing of bad summary block counts at mount time.
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap '_cleanup; exit $status' 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# remove previous $seqres.full before test
rm -f $seqres.full
# real QA test starts here
# Modify as appropriate.
_supported_fs xfs
_require_scratch
echo "Format and mount"
_scratch_mkfs > $seqres.full 2>&1
# pre-lazysbcount filesystems blindly trust the primary sb fdblocks
_require_scratch_xfs_features LAZYSBCOUNT
_scratch_mount >> $seqres.full 2>&1
echo "test file" > $SCRATCH_MNT/testfile
echo "Fuzz fdblocks"
_scratch_unmount
dblocks=$(_scratch_xfs_get_metadata_field dblocks 'sb 0')
_scratch_xfs_set_metadata_field fdblocks $((dblocks * 2)) 'sb 0' > $seqres.full 2>&1
echo "Detection and Correction"
_scratch_mount >> $seqres.full 2>&1
avail=$(stat -c '%a' -f $SCRATCH_MNT)
total=$(stat -c '%b' -f $SCRATCH_MNT)
echo "avail: $avail" >> $seqres.full
echo "total: $total" >> $seqres.full
test "$avail" -gt "$total" && echo "free space bad: $avail > $total"
# success, all done
status=0
exit