2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Ernesto A. Fernandez. All Rights Reserved.
7 # Fill the device and set as many extended attributes to a file as
8 # possible. Then call setfacl on it and, if this fails for lack of
9 # space, test that the permissions remain the same.
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
31 # remove previous $seqres.full before test
34 # real QA test starts here
36 # Modify as appropriate.
41 _require_attrs trusted
43 _scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1
44 _scratch_mount || _fail "mount failed"
46 TFILE=$SCRATCH_MNT/testfile.$seq
48 # Create the test file and choose its permissions
53 # Try to run out of space so setfacl will fail
54 $XFS_IO_PROG -c "pwrite 0 256m" $TFILE >>$seqres.full 2>&1
57 # Setting acls on an xfs filesystem will succeed even after running out of
58 # space for user attributes. Use trusted attributes
59 while $SETFATTR_PROG -n trusted.$i -v $(perl -e 'print "a"x1024') $TFILE &>/dev/null; do
64 while [ $ret -eq 0 ]; do
66 while [ $j -le 1000 ]; do
67 # On btrfs, setfattr will sometimes fail when free space is
68 # low, long before it's actually exhausted. Insist until it
70 $SETFATTR_PROG -n trusted.$i"x"$j $TFILE &>/dev/null
78 if setfacl -m m:r $TFILE &>/dev/null; then
79 # setfacl succeeded, so the test was meaningless
80 # The filesystem might still have an issue
81 _notrun "$FSTYP succeeds in setting acls despite running out of space for user attrs"
84 # Since setfacl failed, the permissions should not have changed