2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red hat, Inc. All Rights Reserved.
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.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
30 # remove previous $seqres.full before test
33 # real QA test starts here
35 # Modify as appropriate.
38 _require_attrs trusted
40 _scratch_mkfs > $seqres.full 2>&1 || _fail "mkfs"
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
47 # start a background getxattr loop for the existing xattr
48 runfile="$tmp.getfattr"
50 while [ -e $runfile ]; do
51 _getfattr --absolute-names -n trusted.small $SCRATCH_MNT/file \
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
67 echo Silence is golden