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 32k" $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 # 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 if xfs_bmap $file | grep 'no extents' > /dev/null
81 echo corrupt file $file - non-zero size but no extents
82 elif xfs_bmap $file | grep 'hole' > /dev/null
84 echo corrupt file $file - contains holes