blob: 9f03eb5286741801dbb72963f3dea3001a437795 (
plain)
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
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2021 Oracle. All Rights Reserved.
#
# FS QA Test No. 158
#
# Check that we can upgrade a filesystem to support inobtcount and that
# everything works properly after the upgrade.
. ./common/preamble
_begin_fstest auto quick inobtcount
# Import common functions.
. ./common/filter
# real QA test starts here
_supported_fs xfs
_require_scratch_xfs_inobtcount
_require_command "$XFS_ADMIN_PROG" "xfs_admin"
_require_xfs_repair_upgrade inobtcount
# Make sure we can't format a filesystem with inobtcount and not finobt.
_scratch_mkfs -m crc=1,inobtcount=1,finobt=0 &> $seqres.full && \
echo "Should not be able to format with inobtcount but not finobt."
# Make sure we can't upgrade a filesystem to inobtcount without finobt.
_scratch_mkfs -m crc=1,inobtcount=0,finobt=0 >> $seqres.full
_scratch_xfs_admin -O inobtcount=1 2>> $seqres.full
_check_scratch_xfs_features INOBTCNT
# Format V5 filesystem without inode btree counter support and populate it.
_scratch_mkfs -m crc=1,inobtcount=0 >> $seqres.full
_scratch_mount
mkdir $SCRATCH_MNT/stress
$FSSTRESS_PROG -d $SCRATCH_MNT/stress -n 1000 >> $seqres.full
echo moo > $SCRATCH_MNT/urk
_scratch_unmount
# Upgrade filesystem to have the counters and inject failure into repair and
# make sure that the only path forward is to re-run repair on the filesystem.
echo "Fail partway through upgrading"
XFS_REPAIR_FAIL_AFTER_PHASE=2 _scratch_xfs_repair -c inobtcount=1 2>> $seqres.full
test $? -eq 137 || echo "repair should have been killed??"
_check_scratch_xfs_features NEEDSREPAIR INOBTCNT
_try_scratch_mount &> $tmp.mount
res=$?
_filter_error_mount < $tmp.mount
if [ $res -eq 0 ]; then
echo "needsrepair should have prevented mount"
_scratch_unmount
fi
echo "Re-run repair to finish upgrade"
_scratch_xfs_repair 2>> $seqres.full
_check_scratch_xfs_features NEEDSREPAIR INOBTCNT
echo "Filesystem should be usable again"
_scratch_mount
$FSSTRESS_PROG -d $SCRATCH_MNT/stress -n 1000 >> $seqres.full
_scratch_unmount
_check_scratch_fs
_check_scratch_xfs_features INOBTCNT
echo "Make sure we have nonzero counters"
_scratch_xfs_db -c 'agi 0' -c 'print ino_blocks fino_blocks' | \
sed -e 's/= 0$/= ZERO/g' -e 's/= [0-9]*/= NONZERO/g'
echo "Make sure we can't re-add inobtcount"
_scratch_xfs_admin -O inobtcount=1 2>> $seqres.full
echo "Mount again, look at our files"
_scratch_mount >> $seqres.full
cat $SCRATCH_MNT/urk
status=0
exit
|