4 # exercise xfs_repair repairing broken filesystems (root inodes)
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
37 umount $SCRATCH_DEV 2>/dev/null
41 trap "_cleanup; exit \$status" 0 1 2 3 15
43 # get standard environment, filters and checks
48 # nuke the root, rt bitmap, and rt summary inodes
52 echo "Corrupting root inode - setting bits to $1"
53 _check_repair $1 "inode $rootino"
54 echo "Corrupting rt bitmap inode - setting bits to $1"
55 _check_repair $1 "inode $rbmino"
56 echo "Corrupting rt summary inode - setting bits to $1"
57 _check_repair $1 "inode $rsumino"
62 # IRIX checks for valid user and group ids as we have a
64 # As it is unsigned on Linux, this test is not done
65 # (i.e. -1 is a valid id on Linux but not on IRIX)
66 # So we make the output the same for both OS's.
70 egrep -v 'bad user id 0xffffffff|bad group id 0xffffffff'
73 # real QA test starts here
75 _supported_os IRIX Linux
78 _require_no_large_scratch_dev
80 # devzero blows away 512byte blocks, so make 512byte inodes (at least)
81 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
83 [ $isize -lt 512 ] && \
84 _scratch_mkfs_xfs -isize=512 | _filter_mkfs >/dev/null 2>&1
86 # link correct .out file
87 FEATURES=$(_get_os_name)
88 if [ $_fs_has_crcs -eq 1 ]; then
89 FEATURES=$FEATURES,crc
91 _link_out_file_named $seqfull.out "$FEATURES"
93 `xfs_db -r -c sb -c p $SCRATCH_DEV | grep 'ino = ' | \
94 sed -e 's/ //g' -e 's/^/export /'`
96 # check we won't get any quota inodes setup on mount
98 src/feature -U $SCRATCH_DEV && \
99 _notrun "UQuota are enabled, test needs controlled sb recovery"
100 src/feature -G $SCRATCH_DEV && \
101 _notrun "GQuota are enabled, test needs controlled sb recovery"
102 src/feature -P $SCRATCH_DEV && \
103 _notrun "PQuota are enabled, test needs controlled sb recovery"
106 # rootino, rbmino, and rsumino are now set (lets blow em away!)
108 _check_root_inos -1 | _filter_bad_ids