Files
apfstests/tests/xfs/424
T
Xiao Yang 70076b9394 xfs/424: add check for finobt && update comments
1) This test can check if setting types causes error regardless of
   supporting crc, so we can update existed comments about it.  We
   also add new comments about known issues triggered in this test.

2) When finobt is disabled, xfs_db fails to get current address of
   free_root, as below:
   xfs_db -c "agi" -c "addr free_root" -c "daddr" /dev/sda11
   Metadata CRC error detected at xfs_inobt block 0x0/0x1000
   ...
   Running related tests without finobt makes no sense, so we add
   check for finobt.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2017-08-15 17:20:13 +08:00

122 lines
3.7 KiB
Bash
Executable File

#! /bin/bash
# FS QA Test 424
#
# This case checks if setting type causes error.
#
# On crc filesystems, xfs_db doesn't take sector size into account
# when setting type, and this can result in an errant crc.
# This issue has been fixed in xfsprogs-dev:
# '55f224b ("xfs_db: update buffer size when new type is set")'
#
# On crc filesystems, when setting the type to "inode" the verifier
# validates multiple inodes in the current fs block, so setting the
# buffer size to that of just one inode is not sufficient and it'll
# emit spurious verifier errors for all but the first.
# This issue has been fixed in xfsprogs-dev:
# '533d1d2 ("xfs_db: properly set inode type")'
#-----------------------------------------------------------------------
# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#-----------------------------------------------------------------------
#
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.*
}
filter_dbval()
{
awk '{ print $4 }'
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# remove previous $seqres.full before test
rm -f $seqres.full
# Modify as appropriate
_supported_os Linux
_supported_fs xfs
_require_scratch
echo "Silence is golden."
# real QA test starts here
# for different sector sizes, ensure no CRC errors are falsely reported.
# Supported types include: agf, agfl, agi, attr3, bmapbta,
# bmapbtd, bnobt, cntbt, data, dir3, dqblk, inobt, inodata,
# inode, log, rtbitmap, rtsummary, sb, symlink, text, finobt.
# For various sector sizes, test some types that involve type size.
#
# NOTE: skip attr3, bmapbta, bmapbtd, dir3, dqblk, inodata, symlink
# rtbitmap, rtsummary, log
#
sec_sz=`_min_dio_alignment $SCRATCH_DEV`
while [ $sec_sz -le 4096 ]; do
sector_sizes="$sector_sizes $sec_sz"
sec_sz=$((sec_sz * 2))
done
for SECTOR_SIZE in $sector_sizes; do
finobt_enabled=0
$MKFS_XFS_PROG -f -s size=$SECTOR_SIZE $SCRATCH_DEV | \
grep -q 'finobt=1' && finobt_enabled=1
for TYPE in agf agi agfl sb; do
DADDR=`_scratch_xfs_db -c "$TYPE" -c "daddr" | filter_dbval`
_scratch_xfs_db -c "daddr $DADDR" -c "type $TYPE"
done
DADDR=`_scratch_xfs_db -c "sb" -c "addr rootino" -c "daddr" |
filter_dbval`
_scratch_xfs_db -c "daddr $DADDR" -c "type inode"
DADDR=`_scratch_xfs_db -c "agf" -c "addr bnoroot" -c "daddr" |
filter_dbval`
_scratch_xfs_db -c "daddr $DADDR" -c "type bnobt"
DADDR=`_scratch_xfs_db -c "agf" -c "addr cntroot" -c "daddr" |
filter_dbval`
_scratch_xfs_db -c "daddr $DADDR" -c "type cntbt"
DADDR=`_scratch_xfs_db -c "agi" -c "addr root" -c "daddr" |
filter_dbval`
_scratch_xfs_db -c "daddr $DADDR" -c "type inobt"
if [ $finobt_enabled -eq 1 ]; then
DADDR=`_scratch_xfs_db -c "agi" -c "addr free_root" -c "daddr" |
filter_dbval`
_scratch_xfs_db -c "daddr $DADDR" -c "type finobt"
fi
_scratch_xfs_db -c "daddr $DADDR" -c "type text"
_scratch_xfs_db -c "daddr $DADDR" -c "type data"
done
# success, all done
status=0
exit