1f778966aecb2e0f4065c5848d8f17cafc0f2f63
[xfstests-dev.git] / tests / xfs / 111
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 111
6 #
7 # Infinite xfs_bulkstat bad-inode loop case from Roger Willcocks.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21
22 # real QA test starts here
23 _supported_fs xfs
24 _supported_os Linux
25 _require_scratch
26
27 rm -f $seqres.full
28
29 [ "$XFS_FSR_PROG" = "" ] && _notrun "xfs_fsr not found"
30
31 # real QA test starts here
32 _scratch_unmount 2>/dev/null
33 MKFS_OPTIONS="-bsize=4096"
34 MOUNT_OPTIONS="-o noatime"
35 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
36 _scratch_mount
37
38 echo Create some files
39 I=0
40 while [ $I -lt 1000 ]
41 do
42     $XFS_IO_PROG -f -c "pwrite 0 512" $SCRATCH_MNT/${I} > /dev/null
43     let I=$I+1
44 done
45
46 # Roughly the middle of the created inodes
47 INO=`ls -i $SCRATCH_MNT/512 | awk '{print $1}'`
48 _scratch_unmount
49
50 # Figure out where that middle inode starts
51 BYTE=`_scratch_xfs_db -c "convert inode $INO byte" \
52         | awk '{print $2}' | sed s/[\(\)]//g`
53
54 echo Blat inode clusters
55 $here/src/itrash $SCRATCH_DEV $BYTE
56
57 _try_scratch_mount || _fail "Couldn't mount after itrash"
58
59 echo Attempting bulkstat
60 #$here/src/bstat -q $SCRATCH_MNT
61 $XFS_FSR_PROG -g $SCRATCH_MNT | _filter_scratch
62
63 # Fix up intentional corruption so test can pass
64 _scratch_unmount
65 _scratch_xfs_repair >> $seqres.full 2>&1
66
67 status=0
68 exit