generic/554: hide permision warning on exfat
[xfstests-dev.git] / tests / generic / 403
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 403
6 #
7 # Test racing getxattr requests against large xattr add and remove loop. This
8 # reproduces a bug on XFS where a getxattr of an existing attribute spuriously
9 # returned failure due to races with attribute fork conversion.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/attr
29
30 # remove previous $seqres.full before test
31 rm -f $seqres.full
32
33 # real QA test starts here
34
35 # Modify as appropriate.
36 _supported_fs generic
37 _require_scratch
38 _require_attrs trusted
39
40 _scratch_mkfs > $seqres.full 2>&1 || _fail "mkfs"
41 _scratch_mount
42
43 # create xattr small enough for local format on XFS
44 touch $SCRATCH_MNT/file
45 $SETFATTR_PROG -n trusted.small -v a $SCRATCH_MNT/file
46
47 # start a background getxattr loop for the existing xattr
48 runfile="$tmp.getfattr"
49 touch $runfile
50 while [ -e $runfile ]; do
51         _getfattr --absolute-names -n trusted.small $SCRATCH_MNT/file \
52                 > /dev/null || break
53 done &
54 getfattr_pid=$!
55
56 # while the above is spinning, add and remove a large attribute to cause back
57 # and forth inode attribute fork conversion
58 largeval=`for i in $(seq 0 511); do echo -n a; done`
59 for i in $(seq 0 99); do
60         $SETFATTR_PROG -n trusted.big -v $largeval $SCRATCH_MNT/file
61         $SETFATTR_PROG -x trusted.big $SCRATCH_MNT/file
62 done
63
64 rm -f $runfile
65 wait > /dev/null 2>&1
66
67 echo Silence is golden
68
69 # success, all done
70 status=0
71 exit