2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat, Inc. All Rights Reserved.
7 # Test attribute fork teardown. This test is inspired by a regression in XFS
8 # that resulted in problematic removal of inodes with remote attribute forks
9 # without attribute extents. The attribute fork condition is created by
10 # attempting to set larger attribute values on a filesystem that is at or near
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
25 status=1 # failure is the default!
26 trap "_cleanup; exit \$status" 0 1 2 3 15 25
28 # get standard environment, filters and checks
32 # real QA test starts here
36 _require_xfs_io_command "falloc"
44 # consume nearly all available space (leave ~512kB)
45 avail=`_get_available_space $SCRATCH_MNT`
46 filesizekb=$((avail / 1024 - 512))
47 $XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
50 _scratch_mkfs >> $seqres.full 2>&1
53 for i in $(seq 0 63); do
54 touch $SCRATCH_MNT/$seq.$i
57 # Generate a large attribute value and consume the rest of the space in the
59 $XFS_IO_PROG -fc "pwrite 0 64k" $SCRATCH_MNT/attrval > /dev/null 2>&1
60 _consume_freesp $SCRATCH_MNT/spc
62 # Set attributes on the test files. These should start to hit ENOSPC.
63 for i in $(seq 0 63); do
64 $SETFATTR_PROG -n user.test -v "`cat $SCRATCH_MNT/attrval`" \
65 $SCRATCH_MNT/$seq.$i >> $seqres.full 2>&1
68 # Remove the files with attributes to test attribute fork teardown. Problems
69 # result in dmesg output.
70 rm -f $SCRATCH_MNT/$seq.*
72 echo Silence is golden.