5 # exercise xfs_repair repairing broken filesystems (root inodes)
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of version 2 of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 # Further, this software is distributed without any warranty that it is
19 # free of the rightful claim of any third person regarding infringement
20 # or the like. Any license provided herein, whether implied or
21 # otherwise, applies only to this software file. Patent licenses, if
22 # any, provided herein do not apply to combinations of this program with
23 # other software, or any other product whatsoever.
25 # You should have received a copy of the GNU General Public License along
26 # with this program; if not, write the Free Software Foundation, Inc., 59
27 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
29 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
30 # Mountain View, CA 94043, or:
34 # For further information regarding this notice, see:
36 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 #-----------------------------------------------------------------------
43 echo "QA output created by $seq"
47 status=1 # failure is the default!
51 umount $SCRATCH_DEV 2>/dev/null
55 trap "_cleanup; exit \$status" 0 1 2 3 15
57 # get standard environment, filters and checks
62 # nuke the root, rt bitmap, and rt summary inodes
66 echo "Corrupting root inode - setting bits to $1"
67 _check_repair $1 "inode $rootino"
68 echo "Corrupting rt bitmap inode - setting bits to $1"
69 _check_repair $1 "inode $rbmino"
70 echo "Corrupting rt summary inode - setting bits to $1"
71 _check_repair $1 "inode $rsumino"
74 # real QA test starts here
77 # devzero blows away 512byte blocks, so make 512byte inodes
78 mkfs_xfs -isize=512 $SCRATCH_DEV | _filter_mkfs 2>/dev/null
79 `xfs_db -r -c sb -c p $SCRATCH_DEV | grep 'ino = ' | \
80 sed -e 's/ //g' -e 's/^/export /'`
82 # check we won't get any quota inodes setup on mount
83 mount -t xfs $SCRATCH_DEV $SCRATCH_MNT
84 src/feature -U $SCRATCH_DEV && \
85 _notrun "Quota are enabled, test needs controlled sb recovery"
86 src/feature -G $SCRATCH_DEV && \
87 _notrun "Quota are enabled, test needs controlled sb recovery"
90 # rootino, rbmino, and rsumino are now set (lets blow em away!)