2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
7 # Test for NULL files problem
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "exit \$status" 0 1 2 3 15
18 # get standard environment, filters and checks
22 # real QA test starts here
27 _require_scratch_shutdown
28 _require_xfs_io_command "fiemap"
29 _scratch_mkfs >/dev/null 2>&1
30 _require_metadata_journaling $SCRATCH_DEV
38 $XFS_IO_PROG -f -c "pwrite -b 64k -S 0xff 0 64k" $file > /dev/null
41 echo error creating/writing file $file
44 $XFS_IO_PROG -c "truncate 64k" $file > /dev/null
47 echo error truncating file $file
53 # give the system a chance to write something out
61 if [ ! _check_scratch_fs ]
63 echo error detected in filesystem
68 # check file size and contents
73 # if file does not exist, the create was not logged, skip it
76 # if file size is zero it cannot be corrupt, skip it
79 # if file has non-zero size but no extents then it's contents will be NULLs, bad.
80 num_extents=`_count_extents $file`
81 num_holes=`_count_holes $file`
82 if [ $num_extents -eq 0 ]; then
83 echo corrupt file $file - non-zero size but no extents
84 elif [ $num_holes -ne 0 ]; then
85 echo corrupt file $file - contains holes