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
37 _require_xfs_io_command "falloc"
45 # consume nearly all available space (leave ~512kB)
46 avail=`_get_available_space $SCRATCH_MNT`
47 filesizekb=$((avail / 1024 - 512))
48 $XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
51 _scratch_mkfs >> $seqres.full 2>&1
54 for i in $(seq 0 63); do
55 touch $SCRATCH_MNT/$seq.$i
58 # Generate a large attribute value and consume the rest of the space in the
60 $XFS_IO_PROG -fc "pwrite 0 64k" $SCRATCH_MNT/attrval > /dev/null 2>&1
61 _consume_freesp $SCRATCH_MNT/spc
63 # Set attributes on the test files. These should start to hit ENOSPC.
64 for i in $(seq 0 63); do
65 $SETFATTR_PROG -n user.test -v "`cat $SCRATCH_MNT/attrval`" \
66 $SCRATCH_MNT/$seq.$i >> $seqres.full 2>&1
69 # Remove the files with attributes to test attribute fork teardown. Problems
70 # result in dmesg output.
71 rm -f $SCRATCH_MNT/$seq.*
73 echo Silence is golden.