xfs/029: filter out "extended-header: cycle: 1" from output
[xfstests-dev.git] / tests / xfs / 115
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 115
6 #
7 # Check if the filesystem will lockup when trying to allocate a new inode in
8 # an AG with no free inodes but with a corrupted agi->freecount showing free inodes.
9 #
10 # At the end of the test, the scratch device will purposely be in a corrupted
11 # state, so there is no need for checking that.
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # remove previous $seqres.full before test
32 rm -f $seqres.full
33
34 # real QA test starts here
35
36 # Modify as appropriate.
37 _supported_fs generic
38 _supported_os Linux
39 _require_scratch_nocheck
40 # We corrupt XFS on purpose, and check if assert failures would crash system.
41 _require_no_xfs_bug_on_assert
42 _disable_dmesg_check
43
44 # Make sure we disable finobt if the filesystem supports it, otherwise, just
45 # initialize it with default options.
46 _scratch_mkfs | grep -q "finobt=1" && _scratch_mkfs -m "finobt=0" >/dev/null 2>&1
47
48 # Get the amount of free inodes from the AGI 0, so we can fill up the freecount
49 # structure.
50 freecount=`_scratch_xfs_db -c "agi 0" -c "p freecount" | cut -d' ' -f 3`
51
52 _scratch_mount
53
54 # At the end of filesystem's initialization, AG 0 will have $freecount free
55 # inodes in the agi->freecount, create $freecount extra dummy files to fill it.
56 for i in `seq 1 $freecount`; do
57         touch $SCRATCH_MNT/dummy_file$i
58 done
59
60 _scratch_unmount
61
62 # agi->freecount is 0 here, corrupt it to show extra free inodes
63 _scratch_xfs_db -x -c "agi 0" -c "write freecount 10" >> $seqres.full 2>&1
64
65 _scratch_mount
66
67 # Lock up a buggy kernel
68 touch $SCRATCH_MNT/lockupfile >> $seqres.full 2>&1
69
70 # If we reach this point, the filesystem is fixed
71 echo "Silence is golden"
72 status=0
73 exit