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 64k -S 0xff 0 64k" $file > /dev/null
40 echo error creating/writing file $file
46 # give the system a chance to write something out
54 if [ ! _check_scratch_fs ]
56 echo error detected in filesystem
61 # check file size and contents
66 # if file does not exist, the create was not logged, skip it
69 # if file size is zero it cannot be corrupt, skip it
72 # if file has non-zero size but no extents then it's contents will be NULLs, bad.
73 num_extents=`_count_extents $file`
74 num_holes=`_count_holes $file`
75 if [ $num_extents -eq 0 ]; then
76 echo corrupt file $file - non-zero size but no extents
77 elif [ $num_holes -ne 0 ]; then
78 echo corrupt file $file - contains holes