fstests: check for filesystem FS_IOC_FSSETXATTR support
[xfstests-dev.git] / tests / xfs / 132
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 132
6 #
7 # Catch inobt/on disk inode free state mismatches on V4 filesystems
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 "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/quota
28
29 # remove previous $seqres.full before test
30 rm -f $seqres.full
31
32 # real QA test starts here
33
34 _supported_fs xfs
35 _supported_os Linux
36
37 # we intentionally corrupt the filesystem, so don't check it after the test
38 _require_scratch_nocheck
39
40 # on success, we'll get a shutdown filesystem with a really noisy log message
41 # due to transaction cancellation.  Hence we don't want to check dmesg here.
42 _disable_dmesg_check
43
44 _require_xfs_mkfs_crc
45 _scratch_mkfs -m crc=0 > $seqres.full 2>&1
46
47 # The files that EIO in the golden output changes if we have quotas enabled
48 # so leave it off.
49 _qmount_option "defaults"
50
51 # corrupt an inode in the root inode chunk
52 root_ino=$(_scratch_xfs_get_metadata_field 'rootino' 'sb 0')
53 corrupt_ino=$((root_ino + 15))
54 _scratch_xfs_set_metadata_field 'core.mode' 0100644 "inode $corrupt_ino"
55
56 _scratch_mount
57
58 # The corrupt inode should be tripped over during these initial file creates.
59 touch $SCRATCH_MNT/file{0,1,2,3,4,5}{0,1,2,3,4,5} 2>&1 | _filter_scratch
60
61 # success, all done
62 status=0
63 exit