2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
7 # exercise xfs_repair repairing broken filesystems (root inodes)
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
21 _scratch_unmount 2>/dev/null
25 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
32 # nuke the root, rt bitmap, and rt summary inodes
36 echo "Corrupting root inode - setting bits to $1"
37 _check_repair $1 "inode $rootino"
38 echo "Corrupting rt bitmap inode - setting bits to $1"
39 _check_repair $1 "inode $rbmino"
40 echo "Corrupting rt summary inode - setting bits to $1"
41 _check_repair $1 "inode $rsumino"
46 # IRIX checks for valid user and group ids as we have a
48 # As it is unsigned on Linux, this test is not done
49 # (i.e. -1 is a valid id on Linux but not on IRIX)
50 # So we make the output the same for both OS's.
54 egrep -v 'bad user id 0xffffffff|bad group id 0xffffffff'
57 # real QA test starts here
62 _require_no_large_scratch_dev
64 # devzero blows away 512byte blocks, so make 512byte inodes (at least)
65 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
67 if [ $isize -lt 512 ]; then
68 _scratch_mkfs_xfs -isize=512 | _filter_mkfs 2>$tmp.mkfs >/dev/null
72 # link correct .out file
74 if [ $_fs_has_crcs -eq 1 ]; then
77 _link_out_file_named $seqfull.out "$FEATURES"
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
84 src/feature -U $SCRATCH_DEV && \
85 _notrun "UQuota are enabled, test needs controlled sb recovery"
86 src/feature -G $SCRATCH_DEV && \
87 _notrun "GQuota are enabled, test needs controlled sb recovery"
88 src/feature -P $SCRATCH_DEV && \
89 _notrun "PQuota are enabled, test needs controlled sb recovery"
92 # rootino, rbmino, and rsumino are now set (lets blow em away!)
94 _check_root_inos -1 | _filter_bad_ids