2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
7 # Test for NULL files problem
8 # test inode size is on disk after sync - expose log replay bug
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "exit \$status" 0 1 2 3 15
19 # get standard environment, filters and checks
23 # 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
35 # check file size and contents
40 # if file is missing then sync failed
43 # if file size is not 32KB then sync failed
44 if [ `ls -l $file | tr -s ' ' | cut -d ' ' -f 5` -eq 32768 ]
46 # if file has non-zero size but no extents then it's contents will be NULLs, bad.
47 num_extents=`_count_extents $file`
48 if [ $num_extents -eq 0 ]; then
49 echo corrupt file $file - non-zero size but no extents
54 echo file $file has incorrect size - sync failed
57 echo file $file missing - sync failed
63 # create files and sync them
68 $XFS_IO_PROG -f -c "pwrite -b 32k -S 0xff 0 32k" $file > /dev/null
71 echo error creating/writing file $file
77 # sync, then shutdown immediately after, then remount and test
83 if [ ! _check_scratch_fs ]
85 echo error detected in filesystem