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
47 # give the system a chance to write something out
55 if [ ! _check_scratch_fs ]
57 echo error detected in filesystem
62 # check file size and contents
67 # if file does not exist, the create was not logged, skip it
70 # if file size is zero it cannot be corrupt, skip it
73 # if file has non-zero size but no extents then it's contents will be NULLs, bad.
74 num_extents=`_count_extents $file`
75 num_holes=`_count_holes $file`
76 if [ $num_extents -eq 0 ]; then
77 echo corrupt file $file - non-zero size but no extents
78 elif [ $num_holes -ne 0 ]; then
79 echo corrupt file $file - contains holes