3 #-----------------------------------------------------------------------
4 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it would be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #-----------------------------------------------------------------------
23 # exercise xfs_repair repairing broken filesystems (root inodes)
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
38 umount $SCRATCH_DEV 2>/dev/null
42 trap "_cleanup; exit \$status" 0 1 2 3 15
44 # get standard environment, filters and checks
49 # link correct .out file
50 _link_out_file $seq.out
52 # nuke the root, rt bitmap, and rt summary inodes
56 echo "Corrupting root inode - setting bits to $1"
57 _check_repair $1 "inode $rootino"
58 echo "Corrupting rt bitmap inode - setting bits to $1"
59 _check_repair $1 "inode $rbmino"
60 echo "Corrupting rt summary inode - setting bits to $1"
61 _check_repair $1 "inode $rsumino"
66 # IRIX checks for valid user and group ids as we have a
68 # As it is unsigned on Linux, this test is not done
69 # (i.e. -1 is a valid id on Linux but not on IRIX)
70 # So we make the output the same for both OS's.
74 egrep -v 'bad user id 0xffffffff|bad group id 0xffffffff'
77 # real QA test starts here
79 _supported_os IRIX Linux
84 # devzero blows away 512byte blocks, so make 512byte inodes (at least)
85 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
87 [ $isize -lt 512 ] && \
88 _scratch_mkfs_xfs -isize=512 | _filter_mkfs >/dev/null 2>&1
90 `xfs_db -r -c sb -c p $SCRATCH_DEV | grep 'ino = ' | \
91 sed -e 's/ //g' -e 's/^/export /'`
93 # check we won't get any quota inodes setup on mount
95 src/feature -U $SCRATCH_DEV && \
96 _notrun "UQuota are enabled, test needs controlled sb recovery"
97 src/feature -G $SCRATCH_DEV && \
98 _notrun "GQuota are enabled, test needs controlled sb recovery"
99 src/feature -P $SCRATCH_DEV && \
100 _notrun "PQuota are enabled, test needs controlled sb recovery"
103 # rootino, rbmino, and rsumino are now set (lets blow em away!)
105 _check_root_inos -1 | _filter_bad_ids