1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved.
#
# 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")'
. ./common/preamble
_begin_fstest auto quick db
filter_dbval()
{
awk '{ print $4 }'
}
# Import common functions.
. ./common/filter
# Modify as appropriate
_supported_fs xfs
# Since we have an open-coded mkfs call, disable the external devices and
# don't let the post-check fsck actually run since it'll trip over us not
# using the external devices.
_require_scratch_nocheck
export SCRATCH_LOGDEV=
export SCRATCH_RTDEV=
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
|