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.
41 _scratch_mkfs > $seqres.full 2>&1 || _fail "mkfs"
44 # create xattr small enough for local format on XFS
45 touch $SCRATCH_MNT/file
46 $SETFATTR_PROG -n trusted.small -v a $SCRATCH_MNT/file
48 # start a background getxattr loop for the existing xattr
49 runfile="$tmp.getfattr"
51 while [ -e $runfile ]; do
52 _getfattr --absolute-names -n trusted.small $SCRATCH_MNT/file \
57 # while the above is spinning, add and remove a large attribute to cause back
58 # and forth inode attribute fork conversion
59 largeval=`for i in $(seq 0 511); do echo -n a; done`
60 for i in $(seq 0 99); do
61 $SETFATTR_PROG -n trusted.big -v $largeval $SCRATCH_MNT/file
62 $SETFATTR_PROG -x trusted.big $SCRATCH_MNT/file
68 echo Silence is golden