generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / xfs / 033
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 033
6 #
7 # exercise xfs_repair repairing broken filesystems (root inodes)
8 #
9 seqfull=$0
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17
18 _cleanup()
19 {
20     cd /
21     _scratch_unmount 2>/dev/null
22     rm -f $tmp.*
23 }
24
25 trap "_cleanup; exit \$status" 0 1 2 3 15
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30 . ./common/repair
31 . ./common/quota
32
33 # nuke the root, rt bitmap, and rt summary inodes
34
35 _check_root_inos()
36 {
37         echo "Corrupting root inode - setting bits to $1"
38         _check_repair $1 "inode $rootino"
39         echo "Corrupting rt bitmap inode - setting bits to $1"
40         _check_repair $1 "inode $rbmino"
41         echo "Corrupting rt summary inode - setting bits to $1"
42         _check_repair $1 "inode $rsumino"
43 }
44
45 #
46 # pv#909621
47 # IRIX checks for valid user and group ids as we have a 
48 # limit of MAXID
49 # As it is unsigned on Linux, this test is not done
50 # (i.e. -1 is a valid id on Linux but not on IRIX)
51 # So we make the output the same for both OS's.
52 #
53 _filter_bad_ids()
54 {
55         egrep -v 'bad user id 0xffffffff|bad group id 0xffffffff'
56 }
57
58 # real QA test starts here
59 _supported_fs xfs
60
61 _require_scratch
62 _require_no_large_scratch_dev
63
64 # devzero blows away 512byte blocks, so make 512byte inodes (at least)
65 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
66 . $tmp.mkfs
67 if [ $isize -lt 512 ]; then
68         _scratch_mkfs_xfs -isize=512 | _filter_mkfs 2>$tmp.mkfs >/dev/null
69         . $tmp.mkfs
70 fi
71
72 # link correct .out file
73 FEATURES=
74 if [ $_fs_has_crcs -eq 1 ]; then
75         FEATURES=crc
76 fi
77 _link_out_file_named $seqfull.out "$FEATURES"
78
79 `_scratch_xfs_db -r -c sb -c p | grep 'ino = ' | \
80         sed -e 's/ //g' -e 's/^/export /'`
81
82 # check we won't get any quota inodes setup on mount
83 _qmount_option noquota
84 _scratch_mount
85 $here/src/feature -U $SCRATCH_DEV && \
86         _notrun "UQuota are enabled, test needs controlled sb recovery"
87 $here/src/feature -G $SCRATCH_DEV && \
88         _notrun "GQuota are enabled, test needs controlled sb recovery"
89 $here/src/feature -P $SCRATCH_DEV && \
90         _notrun "PQuota are enabled, test needs controlled sb recovery"
91 _scratch_unmount
92
93 # We fixed some bugs in xfs_repair that caused us to have to reset the inode
94 # link counts on the root inode twice.  That wasn't related to what this test
95 # is checking, so remove the nlink reset line from the golden output and filter
96 # old xfsprogs to avoid introducing new regressions.
97 filter_repair() {
98         sed -e '/resetting inode INO nlinks from 1 to 2/d'
99 }
100
101 # rootino, rbmino, and rsumino are now set (lets blow em away!)
102 _check_root_inos 0 | filter_repair
103 _check_root_inos -1 | filter_repair | _filter_bad_ids
104
105 # success, all done
106 status=0
107 exit