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 _begin_fstest shutdown metadata rw auto
13 # Import common functions.
16 # real QA test starts here
20 _require_scratch_shutdown
21 _require_xfs_io_command "fiemap"
22 _scratch_mkfs >/dev/null 2>&1
23 _require_metadata_journaling $SCRATCH_DEV
28 # check file size and contents
33 # if file is missing then sync failed
36 # if file size is not 32KB then sync failed
37 if [ `ls -l $file | tr -s ' ' | cut -d ' ' -f 5` -eq 32768 ]
39 # if file has non-zero size but no extents then it's contents will be NULLs, bad.
40 num_extents=`_count_extents $file`
41 if [ $num_extents -eq 0 ]; then
42 echo corrupt file $file - non-zero size but no extents
47 echo file $file has incorrect size - sync failed
50 echo file $file missing - sync failed
56 # create files and sync them
61 $XFS_IO_PROG -f -c "pwrite -b 32k -S 0xff 0 32k" $file > /dev/null
64 echo error creating/writing file $file
70 # sync, then shutdown immediately after, then remount and test
76 if [ ! _check_scratch_fs ]
78 echo error detected in filesystem