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
26 _require_scratch_shutdown
27 _require_xfs_io_command "fiemap"
28 _scratch_mkfs >/dev/null 2>&1
29 _require_metadata_journaling $SCRATCH_DEV
37 $XFS_IO_PROG -f -c "pwrite -b 32k -S 0xff 0 32k" $file > /dev/null
40 echo error creating/writing file $file
43 $XFS_IO_PROG -c "truncate 64k" $file > /dev/null
46 echo error truncating file $file
52 # give the system a chance to write something out
60 if [ ! _check_scratch_fs ]
62 echo error detected in filesystem
67 # check file size and contents
72 # if file does not exist, the create was not logged, skip it
75 # if file size is zero it cannot be corrupt, skip it
78 # if file has non-zero size but no extents then it's contents will be NULLs, bad.
79 num_extents=`_count_extents $file`
80 if [ $num_extents -eq 0 ]; then
81 echo corrupt file $file - non-zero size but no extents