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 _begin_fstest auto quick attr enospc
16 _register_cleanup "_cleanup" 25
18 # Import common functions.
21 # real QA test starts here
25 _require_xfs_io_command "falloc"
31 # consume nearly all available space (leave ~512kB)
32 avail=`_get_available_space $SCRATCH_MNT`
33 filesizekb=$((avail / 1024 - 512))
34 $XFS_IO_PROG -fc "falloc 0 ${filesizekb}k" $file
37 _scratch_mkfs >> $seqres.full 2>&1
40 for i in $(seq 0 63); do
41 touch $SCRATCH_MNT/$seq.$i
44 # Generate a large attribute value and consume the rest of the space in the
46 $XFS_IO_PROG -fc "pwrite 0 64k" $SCRATCH_MNT/attrval > /dev/null 2>&1
47 _consume_freesp $SCRATCH_MNT/spc
49 # Set attributes on the test files. These should start to hit ENOSPC.
50 for i in $(seq 0 63); do
51 $SETFATTR_PROG -n user.test -v "`cat $SCRATCH_MNT/attrval`" \
52 $SCRATCH_MNT/$seq.$i >> $seqres.full 2>&1
55 # Remove the files with attributes to test attribute fork teardown. Problems
56 # result in dmesg output.
57 rm -f $SCRATCH_MNT/$seq.*
59 echo Silence is golden.