fstests: check for filesystem FS_IOC_FSSETXATTR support
[xfstests-dev.git] / tests / xfs / 053
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test 053
6 #
7 # Ensure that xfs_repair can properly spot SGI_ACL_FILE
8 # and SGI_ACL_DEFAULT in the root attr namespace.
9 #
10 # Due to bugs here and there, we sometimes matched on partial
11 # strings with those names, and threw off xfs_repair.
12 #
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20
21 # get standard environment, filters and checks
22 . ./common/rc
23 . ./common/filter
24 . ./common/attr
25
26 _cleanup()
27 {
28         cd /
29         rm -f $tmp.*
30 }
31 trap "_cleanup; exit \$status" 0 1 2 3 15
32
33 # real QA test starts here
34
35 _supported_fs xfs
36 _supported_os Linux
37 _require_scratch
38 _require_attrs
39
40 _scratch_mkfs >/dev/null 2>&1
41 _scratch_mount
42
43 # Create root attr names which are substrings or superstrings
44 # of the reserved ACL names, and make sure xfs_repair copes.
45
46 # Due to various bugs, either the compared length was shorter
47 # than the reserved name (7 chars), so substrings matched, and/or only
48 # the reserved name length was compared, so superstrings matched.
49
50 rm -f $SCRATCH_MNT/$seq.*
51
52 # actual reserved names:
53 #           SGI_ACL_FILE        SGI_ACL_DEFAULT
54 for NAME in SGI_ACL \
55             SGI_ACL_F           SGI_ACL_D \
56             SGI_ACL_FILE_FOO    SGI_ACL_DEFAULT_FOO; do
57         touch $SCRATCH_MNT/${seq}.${NAME}
58         $ATTR_PROG -R -s $NAME -V "Wow, such $NAME" $SCRATCH_MNT/$seq.$NAME \
59                 | _filter_scratch
60 done
61
62 # Older repair failed because it sees the above names as matching
63 # SGI_ACL_FILE / SGI_ACL_DEFAULT but w/o valid acls on them
64
65 # The test harness will catch this (false positive) corruption
66
67 # success, all done
68 status=0
69 exit