2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
7 # Test for NULL files problem
10 _begin_fstest shutdown metadata log auto
12 # Import common functions.
15 # real QA test starts here
19 _require_scratch_shutdown
20 _require_xfs_io_command "fiemap"
21 _scratch_mkfs >/dev/null 2>&1
22 _require_metadata_journaling $SCRATCH_DEV
30 $XFS_IO_PROG -f -c "pwrite -b 32k -S 0xff 0 32k" $file > /dev/null
33 echo error creating/writing file $file
36 $XFS_IO_PROG -c "truncate 64k" $file > /dev/null
39 echo error truncating file $file
45 # give the system a chance to write something out
53 if [ ! _check_scratch_fs ]
55 echo error detected in filesystem
60 # check file size and contents
65 # if file does not exist, the create was not logged, skip it
68 # if file size is zero it cannot be corrupt, skip it
71 # if file has non-zero size but no extents then it's contents will be NULLs, bad.
72 num_extents=`_count_extents $file`
73 if [ $num_extents -eq 0 ]; then
74 echo corrupt file $file - non-zero size but no extents