4 # Test for NULL files problem
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
8 #-----------------------------------------------------------------------
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
30 # real QA test starts here
32 _supported_os Linux IRIX
36 _scratch_mkfs_xfs >/dev/null 2>&1
44 xfs_io -f -c "pwrite -b 64k -S 0xff 0 64k" $file > /dev/null
47 echo error creating/writing file $file
50 xfs_io -c "truncate 64k" $file > /dev/null
53 echo error truncating file $file
59 # give the system a chance to write something out
62 src/godown $SCRATCH_MNT
67 if [ ! _check_scratch_fs ]
69 echo error detected in filesystem
74 # check file size and contents
79 # if file does not exist, the create was not logged, skip it
82 # if file size is zero it cannot be corrupt, skip it
85 # if file has non-zero size but no extents then it's contents will be NULLs, bad.
86 if xfs_bmap $file | grep 'no extents' > /dev/null
88 echo corrupt file $file - non-zero size but no extents
89 elif xfs_bmap $file | grep 'hole' > /dev/null
91 echo corrupt file $file - contains holes