xfs/530: skip test if user MKFS_OPTIONS screw up formatting
[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 . ./common/preamble
10 _begin_fstest ioctl
11
12 # Import common functions.
13 . ./common/filter
14
15 # real QA test starts here
16 _supported_fs xfs
17 _require_scratch
18
19 [ "$XFS_FSR_PROG" = "" ] && _notrun "xfs_fsr not found"
20
21 # real QA test starts here
22 _scratch_unmount 2>/dev/null
23 MKFS_OPTIONS="-bsize=4096"
24 MOUNT_OPTIONS="-o noatime"
25 _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
26 _scratch_mount
27
28 echo Create some files
29 I=0
30 while [ $I -lt 1000 ]
31 do
32     $XFS_IO_PROG -f -c "pwrite 0 512" $SCRATCH_MNT/${I} > /dev/null
33     let I=$I+1
34 done
35
36 # Roughly the middle of the created inodes
37 INO=`ls -i $SCRATCH_MNT/512 | awk '{print $1}'`
38 _scratch_unmount
39
40 # Figure out where that middle inode starts
41 BYTE=`_scratch_xfs_db -c "convert inode $INO byte" \
42         | awk '{print $2}' | sed s/[\(\)]//g`
43
44 echo Blat inode clusters
45 $here/src/itrash $SCRATCH_DEV $BYTE
46
47 _try_scratch_mount || _fail "Couldn't mount after itrash"
48
49 echo Attempting bulkstat
50 #$here/src/bstat -q $SCRATCH_MNT
51 $XFS_FSR_PROG -g $SCRATCH_MNT | _filter_scratch
52
53 # Fix up intentional corruption so test can pass
54 _scratch_unmount
55 _scratch_xfs_repair >> $seqres.full 2>&1
56
57 status=0
58 exit